[Tutor] Text processing and functional programming?
Clay Shirky
clay at shirky.com
Wed Aug 13 18:57:19 EDT 2003
> Often, not always. And comprehensions are confusing in themselves
> (although powerful) and 'filter' or 'map' is a much more descriptive
> term for whats going on.
Then this is probably personal -- coming from perl, I find the naturalness
of pythons list expressions intoxicating, and while I agree that map and
filter are somewhat mnemonic, lambda feels kludgy to me, like "We sure shot
ourselves in the foot there with that 'one argument' limit -- better make a
wrapper for inline functions."
Reading Mark Pilgrim's code, for example, I find the list comprehensions
much clearer than the same constructs rendered with classic functions.
So because list comprehensions are a single construct that does the job of
several functions, and because I got here just as 2.3 was launching and so
don't have a history of using map, filter and lambda, I wonder if there is a
guide to FP that explains them in terms of list comprehensions?
-clay
More information about the Tutor
mailing list