Skip to content

Instantly share code, notes, and snippets.

@kouddy
Created April 12, 2015 13:44
Show Gist options
  • Save kouddy/9d01d937c01b998671c5 to your computer and use it in GitHub Desktop.
Save kouddy/9d01d937c01b998671c5 to your computer and use it in GitHub Desktop.
(define (tree-map proc root)
(map (lambda (children)
(cond ((null? children) null)
((pair? children) (tree-map proc children))
(else (proc children))))
root))
(define (square-tree tree) (tree-map square tree))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment