sicp/2_17.sch

6 lines
94 B
Scheme

(define (last-pair l)
(if (null? (cdr l))
(list (car l))
(last-pair (cdr l))))