3 ms·
This morning I listened to the latter part of Lecture 2B: (define (cons x y) (lambda (m) (cond ((= m 0) x) ((= m 1) y))))
by brudgers 14y ago
This morning I listened to the latter part of Lecture 2B:
(define (cons x y)
(lambda (m)
(cond
((= m 0) x)
((= m 1) y))))
(define (car z) (z 0))
(define (cdr z) (z 1))
As Ableson says, it's made of air.
SICP is not a functional programming course - changing values and creating state comes in Chapter 3 [2nd Edition]. It is a course in the creative use of wishful thinking.