[Tutor] Why lambda could be considered evil

alan.gauld@bt.com alan.gauld@bt.com
Tue, 27 Aug 2002 12:51:18 +0100


> > those "change your life" type discoveries in programming.

> I'll have the same experience with lambda.  But until the 
> lightbulb goes off in my head, I'm willing to hear any 
> arguments for or against. How does it change your life?

Purely in a programming sense! I'm not that sad...

But it changes the way you think about programs and how 
they are constructed. For one thing Functional Programming 
starts to really make sense and you start to use those 
concepts in your normal day to day work - even designing 
methods within classes etc.

Of course much of it is good practice that you do anyway 
but understanding lambdas etc helped me see *why* it 
was good practice. Thats where the light-bulb effect 
came in.

Languages like Smalltalk, Lisp, Haskell, ML are all 
much easier to understand once you get the idea of 
lambdas. Basically anywhere where you need to pass 
around functionality as an object (which is basically 
what a lambda is!). Combining lambdas with closures
just provides a different style of programming.

It is esoteric, no doubt about it. You can write 
good code without it. The same is true of OOP. 
But with lambdas behind you you get a new set of 
toys to play with and new concepts become possible.
Big complex problems often become more manageable.

I'm trying to think of a suitable example that fits 
in an email but I can't right off hand. If I do 
I'll post it. And I stress I'm talking about the 
concept of lambdas not the way Python does them.

Alan G.