You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sicp-all-tasks/sicp/2_002e4

14 lines
377 B

Exercise 2.4: Here is an alternative procedural
representation of pairs. For this representation, verify that (car (cons
x y)) yields x for any objects x and y.
(define (cons x y)
(lambda (m) (m x y)))
(define (car z)
(z (lambda (p q) p)))
What is the corresponding definition of cdr? (Hint: To verify that this
works, make use of the substitution model of 1.1.5.)