3 (define (traverse-tree! x)
6 ((eqv? (car x) 'traversed)
7 (cons (traverse-tree! (car (cdr x)))
8 (traverse-tree! (cdr (cdr x)))))
11 (set! x (cons 'traversed (cons (car x) (cdr x))))
12 (traverse-tree! x)))))
14 (define (count-tree x)
17 ((traversed? x) (+ (count-tree (left x))
18 (count-tree (right x))))
21 (set-car! x (traverse x))
22 (+ (count-tree (left x))
23 (count-tree (right x))
26 (define (traversed? x)
28 (eqv? (car (car x)) 'traversed)
43 (define x (list 'a 'b))