Sylvain Joyeux
10/28/2006 1:02:00 PM
> The lambda calculus took it from the Greek Alphabet, who adapted it
> from the Phoenecian Alphabet, and so on (you could keep going
> forever). Actually closures are never called "lambdas", at least not
> in any writing I've read on Lisp, it's just a symbol used to denote a
> closure.
A lambda is not necessary a closure. A lambda is an anonymous function (and
as you will see later, this is *not* a block or a Proc.new { ... })
The meaning of the lambda operator in languages like Ruby is "build an
anonymous function", and it does come from lambda calculus. Lambda (in
Ruby) is building a function (actually, a Proc) from a block.
The "closure" part comes from the fact that blocks are closures. If blocks
weren't closures, lambdas would not be either.
Calling 'return' in Proc.new { return }.call fails with LocalJumpError
while it works in lambda { return }.call . Kernel#lambda really changed
the block into a function.
My 2 cents
--
Sylvain Joyeux