练习2.30
如果这道题感觉有点难度的话,可以回过头来看看75页定义的两个scale-tree。我的定义如下:
(define (square-tree tree)
(cond ((null? tree) ‘())
((not (pair? tree)) (square tree))
(else (cons (square-tree (car tree))
(square-tree (cdrtree))))))
(define (square-tree tree)
(map (lambda (sub-tree)
(if (pair? sub-tree)
(square-tree sub-tree)
(square sub-tree)))
tree))