is reduce same as haskell foldl?

Questions about GP commands and how to do things

Moderators: MSandro, MSandro, MSandro

Post Reply
manyone
Posts: 5
Joined: Nov 5th, '17, 07:56

is reduce same as haskell foldl?

Post by manyone » Nov 21st, '17, 07:59

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?

SimpleSi
Posts: 315
Joined: Jul 2nd, '17, 13:47

Re: is reduce same as haskell foldl?

Post by SimpleSi » Nov 21st, '17, 12:18

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

Post Reply