Last active
November 2, 2019 21:02
-
-
Save chelseatroy/d9ea61731cc1e8f696ee04bb8448898c to your computer and use it in GitHub Desktop.
Making Data out of Procedures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 2.4: Representing data AS procedures | |
(define (2.4-cons x y) | |
(lambda (m) (m x y))) | |
(define (2.4-car z) | |
(z (lambda (p q) p))) | |
(define (2.4-cdr z) | |
(z (lambda (p q) q))) | |
(2.4-car (2.4-cons 2 3)) ;--> 2 | |
(2.4-cdr (2.4-cons 2 3)) ;--> 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment