Skip to content

Instantly share code, notes, and snippets.

@nyuichi
Created December 31, 2014 04:33
Show Gist options
  • Select an option

  • Save nyuichi/867f2fe501264bdfb831 to your computer and use it in GitHub Desktop.

Select an option

Save nyuichi/867f2fe501264bdfb831 to your computer and use it in GitHub Desktop.
(define (make-generic)
(letrec ((self (lambda args
(let ((m (find-method self args)))
(if m
(apply m args)
(error "method not found"))))))
(add-generic self)
self))
(eq? (make-generic) (make-generic)) ;=> #t OH, MY GOSH!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment