Finish lab 3, correct dates on frog journal
This commit is contained in:
30
labs/L03/first-rest-pattern.bak
Normal file
30
labs/L03/first-rest-pattern.bak
Normal file
@ -0,0 +1,30 @@
|
||||
#lang slideshow
|
||||
|
||||
(define (my-map f lst)
|
||||
(cond
|
||||
[(empty? lst) empty]
|
||||
[else (cons (f (first lst))
|
||||
(my-map f (rest lst)))]))
|
||||
|
||||
(define (rainbow p)
|
||||
(map (lambda (color)
|
||||
(colorize p color))
|
||||
(list "red" "orange" "yellow" "green" "blue" "purple")))
|
||||
|
||||
|
||||
(rainbow (circle 10))
|
||||
|
||||
;(define (rainbow2 color-list)
|
||||
; (define (color-mapper gr-obj color-list)
|
||||
; (cond
|
||||
; [(empty? color-list) empty]
|
||||
; [else (cons(colorize gr-obj (first color-list)))
|
||||
; (color-mapper gr-obj (rest color-list))
|
||||
; (color-mapper gr-obj (list "red" "orange" "yellow" "green" "blue" "purple"))]
|
||||
; )
|
||||
; )
|
||||
;)
|
||||
|
||||
|
||||
;[else (cons (colorize gr-obj (first color-list))
|
||||
; (color-mapper gr-obj (rest color-list)))]))
|
@ -12,12 +12,14 @@
|
||||
(list "red" "orange" "yellow" "green" "blue" "purple")))
|
||||
|
||||
|
||||
(rainbow (circle 10))
|
||||
|
||||
(define (rainbow2 p)
|
||||
(define (color-mapper gr-obj color-list)
|
||||
(cond
|
||||
[(empty? color-list) empty]
|
||||
;[else (cons (colorize gr-obj (first color-list))
|
||||
; (color-mapper gr-obj (rest color-list)))]))
|
||||
[eles (cons (colorize))]
|
||||
)
|
||||
(color-mapper p (list "red" "orange" "yellow" "green" "blue" "purple")))
|
||||
[else (cons(colorize gr-obj (first color-list))
|
||||
(color-mapper gr-obj (rest color-list)))]))
|
||||
(color-mapper p (list "red" "orange" "yellow" "green" "blue" "purple")))
|
||||
|
||||
(rainbow2 (circle 20))
|
Reference in New Issue
Block a user