Skip to content

Instantly share code, notes, and snippets.

@jamiltron
Created September 30, 2011 17:05
Show Gist options
  • Save jamiltron/1254366 to your computer and use it in GitHub Desktop.
Save jamiltron/1254366 to your computer and use it in GitHub Desktop.
Adder Closure example/question
(defun make-adder (x)
(lambda (y) (+ x y)))
(defun add-5 (x)
(funcall (make-adder 5) x))
(defun add-6 (x)
(funcall (make-adder 6) x))
(add-5 20)
(add-6 26)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment