3 (define (count-pairs x)
6 (+ (count-pairs (car x))
10 ;; list of exactly 3 pairs which counts as 3
11 (define z1 (cons 'a (cons 'b (cons 'c '()))))
14 ;; list of 3 pairs but counts as 4
15 (define x (list 'a 'b))
16 (define z2 (cons (cons 'c '()) x))
19 ;; list of 3 pairs but counts as 7
20 (define x3 (cons 'a 'b))
21 (define y3 (cons x3 x3))
22 (define z3 (cons y3 y3))
25 ;; list of 3 pairs but count never returns
26 ;;; DON'T RUN THIS. IT WILL GO INTO An INF LOOP
27 (define z4 (cons 'a (cons 'y (cons 'z '()))))
33 (set-cdr! (last-pair z4) z4)