2 ms·
Cons, car and cdr can be defined in terms of lambda, though it's not exactly an efficient implementation: (define (cons x y) (lambda (f) (f x y)))
by mtlmtlmtlmtl 4y ago
Cons, car and cdr can be defined in terms of lambda, though it's not exactly an efficient implementation:
(define (cons x y)
(lambda (f)
(f x y)))
(define (car c)
(c (lambda (x y) x)))
(define (cdr c)
(c (lambda (x y) y)))
- MonkeyClub 4y agoEfficient or not, it's very pretty, I love its self-referential house-of-cardiness :)