Skip to content

Instantly share code, notes, and snippets.

@bishboria
Created April 26, 2011 22:37
Show Gist options
  • Save bishboria/943346 to your computer and use it in GitHub Desktop.
Save bishboria/943346 to your computer and use it in GitHub Desktop.
Original attempt at OO with Scheme
(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