SICP Exercise 2.17-

2.18

(define (reverse items)
  (if (null? (cdr items))
      items
      (append  (reverse (cdr items)) (list(car items)))
      )
  )

(reverse (list 1 2 3 4))
 

2.17

(define (list-pair items)
  (if (null? (cdr items))
      items
      (list-pair (cdr items))
   )
  )
(list-pair (list 1 2 3 4))

你可能感兴趣的:(SICP)