>>>>> Tim Northover <[email protected]> (TN) escribió:
>TN> Steven D'Aprano <[email protected]> writes: >>> Calling all functional programming fans... is Python's built-in reduce() >>> a left-fold or a right-fold? >TN> I get: >>>>> reduce(lambda a, b: a/b, [1.0, 2.0, 3.0]) >TN> 0.16666666666666666 >TN> which looks like a left fold to me. Yes, see the Haskell result: Prelude> foldl (/) 1.0 [1.0, 2.0, 3.0] 0.16666666666666666 Prelude> foldr (/) 1.0 [1.0, 2.0, 3.0] 1.5 -- Piet van Oostrum <[email protected]> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: [email protected] -- http://mail.python.org/mailman/listinfo/python-list
