A question (confusion) about closure



Hi,

I have a confusion regarding closure and its definition. As per Paul
Graham:

When a function refers to a variable defined outside it, it’s called a
free variable. A function that refers to free lexical variable is
called a closure.

However as per CLHS a closure or lexical closure is:

lexical closure n. a function that, when invoked on arguments,
executes the body of a lambda
expression in the lexical environment that was captured at the time of
the creation of the lexical closure, augmented by bindings of the
function's parameters to the corresponding arguments.

lexical environment n. that part of the environment that contains
bindings whose names have lexical scope. A lexical environment
contains, among other things: ordinary bindings of variable names to
values, lexically established bindings of function names to functions,
macros, symbol macros, blocks, tags, and local declarations (see
declare).

Can any pro lisper kindly help me?

Thanks,
Samik
Blog: http://lispsamik.blogspot.com/
.



Relevant Pages

  • Re: A question (confusion) about closure
    ... I have a confusion regarding closure and its definition. ... When a function refers to a variable defined outside it, ... lexical environment n. ... bindings whose names have lexical scope. ...
    (comp.lang.lisp)
  • Re: A question (confusion) about closure
    ... I have a confusion regarding closure and its definition. ... When a function refers to a variable defined outside it, ... lexical environment n. ... bindings whose names have lexical scope. ...
    (comp.lang.lisp)
  • Re: is this a portable CL? (rebind)
    ... collect (funcall fun)) ... form a list instead of closure, which i find a bit ugly. ... By wrapping the LAMBDA in a LET you create new bindings, ...
    (comp.lang.lisp)
  • Re: Ron Garret considered harmful
    ... | lexical variable bindings are elements of lexical bindings. ... lexical variable bindings that have been closed over when a closure was ... in the lexical environment at which the closure was created. ... |> semantics for LET/LET* vs. symbol macros. ...
    (comp.lang.lisp)
  • Re: ARM assembly
    ... no. both Scheme and JavaScript closures may outlive the parent scope. ... because it will create a copy of its captured bindings. ... When the closure finishes, it has ... If the parent function has returned, then we can't copy back the ...
    (alt.lang.asm)