Is reduce() foldl() or foldr()?

Tim Northover T.P.Northover at
Sun Jun 7 14:34:26 CEST 2009

Steven D'Aprano <steve at> writes:

> Calling all functional programming fans... is Python's built-in reduce() 
> a left-fold or a right-fold?

I get:

>>> reduce(lambda a, b: a/b, [1.0, 2.0, 3.0])

which looks like a left fold to me.


More information about the Python-list mailing list