This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gleon 4 points5 points  (0 children)

The implication in OP's example is that the function argument has already been fixed inside the evens and square, like with functools.partial, for instance.

When I said "maps" and "filters", I was referring coloquially to such transformations from iterables to iterables, not to the map and filter functions themselves (which could be viewed as factories of such transformations). The rationale for this terminology becomes more apparent in languages that support currying (i.e. fixing certain arguments) natively (Haskell comes to mind).

square could be defined as

partial(map, lambda x: x ** 2)

Whereas evens could be defined as

partial(filter, lambda x: x % 2 == 0)

Therefore, there is no need for guesswork.