Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Software Design for Flexibility Ch. 2.1.1
(define (identity x) x)
(define (compose f g)
(define (the-composition . args)
(f (apply g args)))
the-composition)
(define ((iterate n) f)
(if (= n 0)
identity
(compose f ((iterate (- n 1)) f))))
(define (square n) (* n n))
(((iterate 3) square) 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment