2022-09-14 09:31:41 -03:00
|
|
|
#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")))
|
|
|
|
|
|
|
|
|
2022-09-15 16:36:37 -03:00
|
|
|
(rainbow (circle 10))
|
|
|
|
|
2022-09-14 09:31:41 -03:00
|
|
|
(define (rainbow2 p)
|
|
|
|
(define (color-mapper gr-obj color-list)
|
|
|
|
(cond
|
|
|
|
[(empty? color-list) empty]
|
2022-09-15 16:36:37 -03:00
|
|
|
[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))
|