Steve,
Everything you say is true (and consistent with what I said), but not
particularly helpful to the original poster.
-s
PS Exotic as it may seem, when I first started coding in Lisp (1970), 'let'
didn't exist, and we wrote ((lambda (a) ...) ...) or (prog (a)...). Even
with proper indentation, reading the correspondence between variables and
values in the first case was clumsy, since they were separated by the body,
but I felt virtuous because I was avoiding evil side-effect programming :-)
.
On Fri, Aug 10, 2012 at 11:42 AM, Steve Haflich <smh at franz.com> wrote:
> Stavros Macrakis <macrakis at alum.mit.edu> wrote:
>
> Most programming languages require explicit declaration of local
> variables (other than function arguments), including all varieties of
> Lisp I'm aware of. A few do this implicitly for variables which are
> assigned to, e.g. Python and R. Maxima does not.
>
> Two minor points (which are barely relevant to the discussion :-)
>
> Common Lisp assigns no semantics whatever to a free (i.e. undeclared)
> reference to a variable, but essentially every implementation treats the
> variable implicitly as though it had been declared special in that
> context. Most warn, at least in the compiler. This is because there is
> a long history of Lisp dialects that provided _only_ special variables,
> so no declarations were necessary or meaningful.
>
> Your "except function arguments" distinction is not a real distinction.
> Constructs such as LET that bind variables are really just semantic
> sugar for the same kind of lambda binding that lambda functions do.
>
> (let ((y (* x x))
> (c (+ x 1)))
> ...)
>
> is semantically equivalent to
>
> (apply (lambda (y c) ...)
> (* x x)
> (x (+ x 1)))
>
> hence LET binding is sometimes confusingly called "lambda binding". Of
> course, implementations usually try to rewrite internal lambdas as lets
> rather than the other way around.
>