[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Free variables in a LAMBDA which names a function
- To: "Stephen E. Robbins" <STEVER%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU>
- Subject: Free variables in a LAMBDA which names a function
- From: BROOKS%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU
- Date: Thu, 26 Mar 1987 04:24:00 -0000
- Cc: common-lisp@SAIL.STANFORD.EDU
- In-reply-to: Msg of 26 Mar 1987 00:01-EST from Stephen E. Robbins <STEVER>
(defun foo (arg)
((lambda (x) (+ x arg)) 5))
I would expect:
(setf arg 16)
(foo 3) ==> 8
That is correct. `arg' is lexically scoped. Except for declaration handling
you can treat an expression with a lambda, of a fixed number of arguments,
in the functional position as if it were the obvious expansion of a let
expression (or vice versa). Declarations (especially special declarations)
screw up this simple model however.