functional programming with map()

Grant Edwards grante at
Mon Feb 25 14:16:32 EST 2002

In article <slrna7l176.3al.quinn at>, Quinn Dunkan wrote:
> On Sun, 24 Feb 2002 19:34:34 -0800, David Eppstein <eppstein at> wrote:
>>In article <a5cb54$27c2$1 at>,
>> Daniel Yoo <dyoo at> wrote:
>>> : But what is the functional equvalent of:
>>> : for x in items:
>>> :     x.f()
> There really is no functional equivalent of that, because it's not a functional
> concept.  If your function doesn't have any side-effects, calling the function
> only to throw away its value does nothing but suck up CPU time.
> If you're calling the method for its side-effects, I'd write:
> for x in items:
>     x.f()
>>I'd prefer
>>[x.f() for x in items]
>>It's not functional syntax, but so what?
> Sure it is.

Methinks there are two definitions of "functional" at work here:

 1) The traditional CS "no side-effects" definition.
 2) Something that looks like a function  call.


Grant Edwards                   grante             Yow!  Yow! I forgot my
                                  at               PAIL!!

More information about the Python-list mailing list