Mailing List Archive

Lambda Functions (fwd)
FWD MESSAGE -----------------------------------------------------------------

Subject: [HM] lambda functions
From: Ivan Van Laningham <ivanlan@callware.com>
Date: Mon, 09 Aug 1999 13:47:15 -0600
To: historia-matematica@chasque.apc.org

Hi All--
I'm working on a book about the Python programming language. Python
allows the use of lambda functions, small anonymous functions that can
speed up processing because they are effectively inlined, and often
require less typing than conventional function definitions.

Why lambda? I realize that the term has come from functional
programming languages, and Python's inventor explicitly took lambda
from Scheme, but I'm interested in the history of the term. Why that
particular letter? I assume it has something to do with the lambda
calculus, but my ignorance runs deep in that area too.

Thank you for your help,
Ivan


Ivan Van Laningham
Callware Technologies, Inc.
ivanlan@callware.com
ivanlan@home.com
http://www.pauahtun.org
See also:
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70


END ------------------------------------------------------------------


Sfakianos
Lambda Functions (fwd) [ In reply to ]
xpolakis@hol.gr (Antreas P. Hatzipolakis) writes:

> ... Why lambda? ...

We answer this question in the end-of-chapter notes for chapter 1 of
Concrete Abstractions(*), pp. 20-21. The authority we cite there is
Barendregt(**). In short, the story is that a circumflex (or "hat")
accent (^) that should have been over the top of the binding occurance
of the variable moved in front of it, and then by visual resemblence
the circumflex with nothing under it was turned into a greek letter
lambda.

That's the interesting part of the story, at least, from Church's
lambda calculi. The later, less interesting part happened a couple
decades later when come Lisp (pre-Scheme), the greek letter had to get
spelled out in roman letters for the sake of primitive and
anglo-centric computer I/O devices.

(*) Max Hailperin, Barbara Kaiser, and Karl Knight. Concrete
Abstractions: An Introduction to Computer Science Using Scheme.
Brooks/Cole Publishing Company, 1999.

(**) Henk Barendregt. "The impact of the lambda calculus in logic and
computer science." The Bulletin of Symbolic Logic, 3(2):181-215,
June 1997.
Lambda Functions (fwd) [ In reply to ]
> ...
> Python allows the use of lambda functions, small anonymous functions
> that can speed up processing because they are effectively inlined,

lambdas don't speed up anything in Python; they're not inlined (let alone
effectively <wink>); they're exactly as expensive as "def" functions to
invoke; they're often a little more expensive than "def" functions in
practice because of repeated construction, e.g.

def f(x):
return x+1

for i in range(1000):
print f(i)

constructs the function object f only once, while

for i in range(1000):
print (lambda x: x+1)(i)

constructs an anonymous function object 1000 times.

next-thing-you-know-you'll-wake-up-in-a-tub-of-ice-with-"call-911"-
scratched-into-your-chest-ly y'rs - tim
Lambda Functions (fwd) [ In reply to ]
> Hi All--
> I'm working on a book about the Python programming language. Python
> allows the use of lambda functions, small anonymous functions that can
> speed up processing because they are effectively inlined, and often
> require less typing than conventional function definitions.
>
> Why lambda? I realize that the term has come from functional
> programming languages, and Python's inventor explicitly took lambda
> from Scheme, but I'm interested in the history of the term. Why that
> particular letter? I assume it has something to do with the lambda
> calculus, but my ignorance runs deep in that area too.

The lambda calculus is the reason as you suspect. This makes sense since the
core of functional abstraction in Scheme (or more generally Lisp) is based on the
lambda construct in the (call-by-value) lambda calculus. The question remains as
to the use of lambda in the lambda calculus. If my sources are correct the use
of lambda results from the limitations of typesetters in the time of the lambda
calculus' creator, Alonzo Church. It seems that Church wanted to use a bar above
a variable to denote that the particular variable was bound in the body of a
lambda expression. However, at some point the bar was replaced by another symbol
(I forget which) preceding the binding instance of the variable. This symbol
eventually was replaced by a lambda.

Of course I am missing some details here.

--
Best Regards,
Bob McGrail

****************************************************

By virtue knowledge

****************************************************
Bard College
Division of Natural Science and Mathematics
P.O. Box 5000
Annandale-on-Hudson, NY 12504
(914)758-7265

mcgrail@bard.edu
http://inside.bard.edu/~mcgrail