(wat-aro)

無職から有職者にランクアップしました

SICP 問題 2.31

(define (tree-map fn tree)
  (map (lambda (sub-tree)
         (if (pair? sub-tree)
             (tree-map fn sub-tree)
             (fn sub-tree)))
       tree))

(define (sqaure x)
  (* x x))

(define (square-tree tree)
  (tree-map square tree))