Page 1 of 1

is reduce same as haskell foldl?

Posted: Nov 21st, '17, 07:59
by manyone
i've proven that reduce can perform sum as shown below
foldsum.png
but i cannot get this reduce to reverse the list
folderr.png
isn't reduce the equivalent of haskell's foldl?

Re: is reduce same as haskell foldl?

Posted: Nov 21st, '17, 12:18
by SimpleSi
My understanding of reduce in languages is that it normally iterates over a list (or function) to "reduce" it like your first example

Using reduce to reverse a data set seems a bit convoluted to me

But as an exercise - here is my method :)
scriptImage10.png