[wellylug] Help in finding a good technical/Linux related bookstore

Phillip Hutchings phillip.hutchings at sitharus.com
Thu Jun 14 09:45:46 NZST 2007


> What's a Lambda?

An anonymous function. More or less. Generally they can be passed
around in variables, they're one of the most useful features of
functional languages. eg in Python:

list.sort(lambda x, y: cmp(x.attr, y.attr))

will sort a list by an attribute. If it's only used once this is a
much nicer way to write it.

Then again, Ruby does this:

array.sort {|x, y| x.attr <=> y.attr}

Which I think looks nicer.

-- 
Phillip Hutchings
http://www.sitharus.com/




More information about the wellylug mailing list