3 [sicp [ch2-2 :only (accumulate)]]))
5 ;; Redefine count-leaves from section 2.2.2 as an accumulation:
7 ;; (define (count-leaves t)
8 ;; (accumulate <??> <??> (map <??> <??>)))
9 (defn count-leaves-with-accumulate [t]
12 (count-leaves-with-accumulate x)
16 (deftest test-count-leaves
17 (let [foo (list (list 1 2) 3 4)]
19 (count-leaves-with-accumulate foo) 4
20 (count-leaves-with-accumulate (list foo)) 4
21 (count-leaves-with-accumulate (list foo foo)) 8)))