Blob


1 (define (count-leaves x)
2 (cond ((null? x) 0)
3 ((not (pair? x)) 1)
4 (else (+ (count-leaves (car x))
5 (count-leaves (cdr x))))))
7 ;;(list 1 (list 2 (list 3 4)))
8 ;;'(1 (2 (3 4)))
10 ;; Exercise 2.26. Suppose we define x and y to be two lists:
12 (define x (list 1 2 3))
13 (define y (list 4 5 6))
15 ;; What result is printed by the interpreter in response to evaluating each of the following expressions:
17 (display (append x y))
18 (newline)
19 (display '(1 2 3 4 5 6))
20 (newline)
21 (newline)
23 (display (cons x y))
24 (newline)
25 (display '((1 2 3) 4 5 6))
26 (newline)
27 (newline)
29 (display (list x y))
30 (newline)
31 (display '((1 2 3) (4 5 6))
32 (newline)