foldr function in Python
greg
greg at cosc.canterbury.ac.nz
Fri Nov 23 20:05:18 EST 2007
Marc 'BlackJack' Rintsch wrote:
> The name is definitely not so good because there is a `foldr` in Haskell
> that just works like `reduce()`.
Because currying is ubiquitous in Haskell, you can use the same
function in either a curried or non-curried fashion. But in
Python you need different functions for the different usage
styles.
My feeling is that Python shouldn't provide a bunch of
different versions of the same function that differ only in
the degree of currying. If you want a particular curried
combination, it's easy enough to create it as needed using
lambda, nested functions or partial().
--
Greg
More information about the Python-list
mailing list