5 (defn square-tree [tree]
7 (not (seq? tree)) (* tree tree)
8 :else (cons (square-tree (first tree))
9 (square-tree (next tree)))))
13 (square-tree '(1 (2 (3 4) 5) (6 7))) '(1 (4 (9 16) 25) (36 49))))
16 (defn square-tree-with-map [tree]
19 (square-tree-with-map sub-tree)
20 (* sub-tree sub-tree)))
23 (deftest test-sq-tree-map
25 (square-tree-with-map '(1 (2 (3 4) 5) (6 7))) '(1 (4 (9 16) 25) (36 49))))