Created
April 26, 2011 22:37
-
-
Save bishboria/943346 to your computer and use it in GitHub Desktop.
Original attempt at OO with Scheme
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
(define (person person-name person-age) | |
(define (name) | |
person-name) | |
(define (age) | |
person-age) | |
(lambda (selector) | |
(cond ((equal? selector 'name) (name)) | |
((equal? selector 'age) (age)) | |
(#t '(I cant do that Dave!))))) | |
(define someone (person 'stuart 28)) | |
(someone 'name) | |
(someone 'age) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment