Skip to content

Instantly share code, notes, and snippets.

@chelseatroy
Last active November 2, 2019 21:02
Show Gist options
  • Save chelseatroy/d9ea61731cc1e8f696ee04bb8448898c to your computer and use it in GitHub Desktop.
Save chelseatroy/d9ea61731cc1e8f696ee04bb8448898c to your computer and use it in GitHub Desktop.
Making Data out of Procedures
; 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