Count-leaves as an accumulation

Redefine count-leaves from section 2.2.2 as an accumulation:

(define (count-leaves t)
  (accumulate <??> <??> (map <??> <??>)))

There are no comments yet.

Authentication required

You must log in to post a comment.

Login
(define x (cons (list 1 2) (list 3 4)))


(check-equal? (count-leaves (list 1 2 (list 3 (list 4 5)))) 5)
(check-equal? (count-leaves (list x x)) 8)