Skip to content

Instantly share code, notes, and snippets.

@amonks
Last active August 29, 2015 14:03
Show Gist options
  • Save amonks/0b979c093d349411059a to your computer and use it in GitHub Desktop.
Save amonks/0b979c093d349411059a to your computer and use it in GitHub Desktop.
;here's the main function, it uses 'map' which we define below
(define (make-circles list-of-colors)
(my-map (lambda (color)
(circle 12 'solid color))
list-of-colors
))
;replacement for built-in 'map' function
(define (my-map f lst)
(cond
[(empty? lst) empty]
[else (cons (f (first lst))
(my-map f (rest lst)))]))
;handy list of colors so we can do (make-circles colors) instead of writing it out
(define colors
(list "red" "green" "blue" "yellow")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment