Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (14 sloc) 333 Bytes
(load "../lib/square")
(define (tree-map func tree)
(map (lambda (sub-tree)
(if (pair? sub-tree)
(tree-map func sub-tree)
(func sub-tree)))
tree))
(define (square-tree tree)
(tree-map square tree))
;;; 使用例
(square-tree
(list 1
(list 2 (list 3 4) 5)
(list 6 7)))