[archives] [homepage]

Problem 2.18
Friday, August 23, 2019; ago; Download .md

SICP Exercise 2.18

This one works without using either length or list-ref.

(define (reverse items)
  (define (iter items result)
    (if (null? items)
        result
        (iter (cdr items) (cons (car items) result))))
  (iter items nil))