List of Functions

Marko Rauhamaa marko at pacujo.net
Mon Mar 28 04:58:54 EDT 2016


Jussi Piitulainen <jussi.piitulainen at helsinki.fi>:

> Ben Bacarisse writes:
>> It's shame that anonymous functions (for that's what's being returned
>> here -- a function with no name) were born of a subject that used
>> arbitrary Greek letters for things. We seem stuck with the mysterious
>> but meaningless "lambda" for a very simple and useful idea.
>
> Well said.
>
> Python should have called it "fun".
>
> I have heard that the use of lambda for this purpose was originally
> not an arbitrary choice but a typographical accident. A misinterpreted
> caret or something. I also seem to remember that I've seen some
> discussion on whether the story is true or not, but I forget which way
> it went.

I don't know the etymology of things, but way back when I learned
combinatory logic, the capital letter Λ was used as the name of the
abstraction algorithm.

Combinatory logic was able to express any formula without variables,
which apparently were somewhat of a sore spot for logicians in the early
20th century. So you took your formula with variables and ran it through
the Λ algorithm to get an equivalent combinator expression that didn't
have any variables.

I always thought the λ calculus arose from the abstraction algorithm.
Once the logicians had "tamed" variables with Λ, they no longer felt the
need to avoid them. You could set aside the clumsy combinators and
incorporate the lambda in the language itself.

...

As for Python, I don't feel a great need for anonymous functions.
However, I keep running into a need for anonymous classes, or, rather,
classless objects. Not a biggie. I just create a one-off inner class and
instantiate it, but I do appreciate Java's syntactic innovation.


Marko



More information about the Python-list mailing list