2015/10/10

SICP 問題 2.4

(define (cons x y)
  (lambda (m) (m x y)))

(define (car z)
  (z (lambda (p q) p)))

;; (car (cons x y)) 
(car (cons x y))
((lambda (m) (m x y)) (lambda (p q) p))
((lambda (p q) p) x y)
x

;; cdr
(define (cdr z)
  (lambda (p q) q))

© 2022 wat-aro