1 (define (list-ref items n)
4 (list-ref (cdr items) (- n 1))))
7 (define (length-ter a count)
10 (length-iter (cdr a) (+ 1 count))))
11 (length-iter items 0))
13 (define (append list1 list2)
17 (append (cdr list1) list2))))
20 (cond ((null? l) (error "Empty List"))
22 (else (last-pair (cdr l)))))
24 (define (test-case actual expected)
27 (format #t "Actual: ~A Expected: ~A" actual expected))
29 ;; (test-case (last-pair (list 23 72 149 34)) '(34))
30 ;; ;; (test-case (last-pair '()) (error "Empty List"))
31 ;; (test-case (last-pair (list 4)) '(4))
40 (test-case (reverse (list 1 4 9 16 25)) '(25 16 9 4 1))
41 (test-case (reverse (list)) '())
42 (test-case (reverse (list 4)) '(4))