exercise-12.scm (301B)
1 (define-library (sicp solutions chapter-3 exercise-12) 2 (import (scheme base)) 3 (export 4 append! 5 last-pair 6 ) 7 8 (begin 9 (define (last-pair x) 10 (cond 11 ((null? (cdr x)) x) 12 (else (last-pair (cdr x))))) 13 14 (define (append! x y) 15 (set-cdr! (last-pair x) y) 16 x)))