Solution to SICP Exercise 2.4

Structure and Interpretation of Computer Programs

Solution to Exercise 2.4:

Substituting through…


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

The definition for cdr:

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

%d bloggers like this: