Created
August 24, 2010 10:38
-
-
Save emasaka/547346 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (traverse-tree tree func) | |
(if (pair? tree) | |
(begin | |
(traverse-tree (car tree) func) | |
(traverse-tree (cdr tree) func) ) | |
(or (null? tree) (func tree)) )) | |
(define sample-list '((3 (5 (7)) 11))) | |
(traverse-tree sample-list print) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment