[Tutor] Are you allowed to shoot camels? [kinda OT]

Alan Gauld alan.gauld at freenet.co.uk
Fri Feb 4 10:28:24 CET 2005


> > I disagree Jeff. It does need lambdas to do FP properly, and
>
> Well, we'll have to continue to disagree on that. ;)  Personally, I
> can't help but think that 'lambda' is descriptive only to people
> who've experienced it elsewhere, and that that does *not* include
the
> majority of the programming community, but I could be mistaken. :)

I would agree, in the same way that complex numbers only make sense
to those who've used them.

But lambda calculus is the foundation of all programming and
all formally trained programmers *should* have had a grounding
in Lambda calculus.

Unfortunately the nature of the industry is such that many
programmers have no theoretical understanding of programming,
they just know some languages and get on with it. That's OK,
and most programmers can quite happily ignore lambdas - and do!
[The analogy is that you don't need to understand electron
 mechanics to be an electrician, but a electronic component
 designer probably should!]

But lambda is just as much a valid mathematical term as
"function" or "set" or "complex number", its not a *construct*
from another language, its a mathematical concept with whole
books written about it.

> Well, given that in Python a function is just a callable code block
> that's bound to a name... ;)  Personally, I fail to see why having
an
> anonymous function is such a huge conceptual advantage,

Because often you just want to pass in a bit of code that
doesn't have a very meaningful function, typically as a
parameter to a control structure. In fact, thinking about
it, I'd guess the most common case for anonymous functions
is when defining new control structures. Now you can give
arbitrary names "codeBlock" or similar

def codeBlock():
    blah
     blah
   blah

repeat(codeBlock,test)

But its more appropriate to the task to do:

repeat(
   blah
     blah
   blah,
test)

It keeps the code block at the execution point.

> Here, ISTM that you're emphasizing the in-line nature of lambdas as
> being their key usage point...  And personally, I prefer to have a
> glossary of terms rather than having to decipher jargon by context.
;)

But a glossary of terms is only useful if it means something.
Its especially useful for things that hang around and get reused,
but for something you use once and throw away labelling it is a
lot of work!

> collections, and effectively renamed, well before I really got a
hold
> on lambdas as anything more than some confusing bit of magic.  Of
> course, I started in C, where I was fairly comfortable with the idea
> of function pointers; function objects are a pretty simple step up,
> abstraction-wise, from that.

I started wth C then moved to Lisp.
When I saw Lambdas in Lisp C function pointers suddenly took on a
new lease of life and that was what started me reading up on
lambda calculus.

Like most programmers I don't use lambda a lot, but its really
nice to have it there for the few occasions I want it...

> intended.  (I've just started to read through SICP, to pick up some
> lisp/scheme, in hopes of understanding the appeal a bit better, so
> maybe there's hope for me yet. ;) )

Maybe. It'll be interesting to hear what you make of it.
Keep us posted.

Alan G.



More information about the Tutor mailing list