1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
; implementation of pairs as functions (define (cons x y) (lambda (which) (cond ((equal? which 'car) x) ((equal? which 'cdr) y) (else (error "Bad message to CONS" which)) ))) (define (car pair) (pair 'car)) (define (cdr pair) (pair 'cdr))