CSC 270 - Survey of Programming Languages: Scheme (Racket)

Lecture 8 - More On Processing Lists

Programs That Produce Lists

Developing find-wages

The find-wages program

;; find-wages : list-of-numbers à 
;;list-of-numbers
;; to create a list of weekly wages from a 
;; list of weekly hours (hourlist)
(define (find-wages hourslist) 
  (cond
		  [(empty? hourlist) empty]
	   [ else (cons (wage (first hourlist))
             (find-wages (rest hourlist)))]
	  )
 )

Lists That Contain Structures

An Inventory List

Constructing an Inventory List

Rewriting Our Inventory Program

Another example: creating a list with less expensive items

Sample Input and Output for extract1

extract1 - Some Examples

Writing extract1

[Back to the Notes Index]