On Thursday, 27 March 2014 at 13:23:27 UTC, monarch_dodra wrote:
On Thursday, 27 March 2014 at 12:48:41 UTC, Simen Kjærås wrote:
Your new fold (foldl? Should we have foldr as well?)
"fold" (from what I understood) is what you call "foldl". It
was discussed to not introduce "foldr", as it's just
"fold!(binaryReverseArgs!Fun)(range.retro);".
I'm not sure I was able to understand what the difference
between "fold" and "foldl" is...
In functional languages,
fold_left(f, a, [b1, ..., bn]) is
f((... (f, (f, a, b1), b2) ...), bn)
as you can see, the innermost f call is on the leftmost sequence
element, and
fold_right(f, [a1, ..., an], b) is
f(a1, (f a2 (... f(an, b) ...)))
That's how I think of them.