Skip to content

Instantly share code, notes, and snippets.

@iorlas
Created February 28, 2011 11:16
Show Gist options
  • Save iorlas/847194 to your computer and use it in GitHub Desktop.
Save iorlas/847194 to your computer and use it in GitHub Desktop.
def f1(x):
x = x
def f2(y):
x += y
return x
return f2
(defn f1 [x]
(let [x (atom x)]
(fn [y]
(swap! x + y)
@x)))
> ((f1 1) 2)
3
(defun f1 (x)
(let ((x x))
(lambda (y)
(setq x (+ x y))
x)))
> (funcall (f1 1) 2)
3
>>> def f1(x):
... x = x
... return lambda y: x+y
>>> f1(1)(2)
3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment