]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_35.rkt
Solution to 4.33. This had been difficult to get right, though conceptually it was
[sicp.git] / src / sicp / ex2_35.rkt
1 #lang racket
2
3 (require "utils.rkt")
4
5 (define (count-leaves t)
6   (accumulate +
7               0
8               (map (lambda (x) (if (pair? x) (count-leaves x) 1)) t)))