Why no closures?
Posted: Fri Oct 21, 2011 8:18 pm
I'm really quite surprised that this isn't in the FAQ.
Why don't we have closures now?
I can do this in Common Lisp:
Was this part of the design philosophy or have we just not done it yet?
Why don't we have closures now?
Code: Select all
> (define (foo x) (lambda (y) (+ x y)))
(lambda (x) (lambda (y) (+ x y)))
> ((foo 3) 4)
ERR: value expected in function + : x
Code: Select all
[16]> (defun foo (x) (lambda (y) (+ x y)))
FOO
[17]> (apply (foo 3) '(5))
8
Was this part of the design philosophy or have we just not done it yet?