Is reduce() foldl() or foldr()?
steve at REMOVE-THIS-cybersource.com.au
Sun Jun 7 12:42:20 CEST 2009
Calling all functional programming fans... is Python's built-in reduce()
a left-fold or a right-fold?
Wikipedia says it's a left-fold:
but other people say it's a right-fold, e.g.:
"... there is a `foldr` in Haskell that just works like `reduce()`"
"Note that Python already has a variation of foldr, called reduce."
So which is correct? Or is it that different people have different
definitions of foldl() and foldr()?
More information about the Python-list