Current progress in lab.
Comitted in non working state, will work on changes/lab later at home.
This commit is contained in:
parent
f826a9c3a3
commit
45cfc4ad5e
23
labs/L03/first-rest-pattern.rkt
Normal file
23
labs/L03/first-rest-pattern.rkt
Normal file
@ -0,0 +1,23 @@
|
||||
#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")))
|
||||
|
||||
|
||||
(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")))
|
1
labs/L03/first-rest-pattern.rkt~
Normal file
1
labs/L03/first-rest-pattern.rkt~
Normal file
@ -0,0 +1 @@
|
||||
#lang slideshow
|
Loading…
Reference in New Issue
Block a user