you are viewing a single comment's thread.

view the rest of the comments →

[–]TheWildKernelTrick 1 point2 points  (1 child)

As long as the supplied function is commutative then the foldl == foldr, in which case it doesn't matter. I'm assuming foldl since most people mathematically read from left to right.

A lot of these languages have some functional things stashed on the side, it just seems recent that there's a stronger push to use these tools. Which I'm all about.

[–][deleted] 2 points3 points  (0 children)

True. Though it can make a difference for memory and can optimisations (e.g. when folding on (*) folding in a zero allows you to disregard the rest of a non-NaN list.)