Skip to content

Instantly share code, notes, and snippets.

@shirok
Created March 8, 2022 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shirok/f14faafb9a016c82ac422806bc0bcaca to your computer and use it in GitHub Desktop.
Save shirok/f14faafb9a016c82ac422806bc0bcaca to your computer and use it in GitHub Desktop.
gosh> (define-method object-+ ((f <procedure>) (g <procedure>)) (lambda (x) (+ (f x) (g x))))
#<generic object-+ (1)>
gosh> (define (f x) (* x 2))
f
gosh> (define (g x) (* x 3))
g
gosh> ((+ f g) 4)
20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment