[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Free variables in a LAMBDA which names a function

    Date: Thu, 26 Mar 87 00:44 EST
    From: Barry Margolin <barmar@Think.COM>
			 My guess is that the compiler you are testing
    translated the definition into:

    (defun foo (arg)
      (#:gensym 5))

    (defun #:gensym (x)
      (+ x arg))

    This would be OK in a dynamically-scoped Lisp (in fact, I believe the
    Maclisp compiler did exactly this), but not in Common Lisp.  Your
    definition should be equivalent to
I don't know of any compiler which did this.  Maclisp's LET
was a macro (at least initially) that turned into LAMBDA in
the functional position like this; in other words, this was
Maclisp's ONLY way to get lexical variables other than arguments
in the argument list.

Maclisp did do something similar to what you describe when
the lambda was not in the functional position; i.e. when
you passed it as an argument.  This meant you would have
had to declare ARG special to get the intended behaviour.