On 3/19/06, Karl Pflästerer <[EMAIL PROTECTED]> wrote:

>>> reduce(lambda s, L: s + sum(L), foo, 0)

Ah ok - well that looks pretty cryptic to me, as I've never used
either lambda or reduce().  However, this looks to be a 'functional'
way of doing what I was doing procedurally, which is, I suppose, what
I was asking.

Would you mind helping to explain how the above works?

Incidentally, I had a look at:

http://www-128.ibm.com/developerworks/linux/library/l-prog.html

As an introduction to functional programming in Python - it looks
interesting.  I've never done any functional programming at all, so it
all seems a little foreign!

Can you recommend another gentle introduction?  Or will this fry my
brain, as I start trying to mix methodologies?

Thanks!

S.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to