haxetink / tink_streams

Streams from the future. With lasers, of course ... whoaaaaa!!!!
The Unlicense
12 stars 9 forks source link

Reduce for simplify PR #27

Open back2dos opened 3 years ago

back2dos commented 3 years ago

Still need to implement reduce for #24. After unsuccessfully banging my head against the wall for a while I'm gravitating towards thinking that reduce should be the basis of everything (and forEach is merely a reduce that accumulates Noise), but it's rather involved and I need to let the idea sink in, because I want to get things right this time around. The issue is here is just a reminder.

kevinresol commented 3 years ago

Will it cause problems if the compiler is able to (if it ever will) check for pureness of the reducer? Or is it just about the internals? Because I prefer having separated forEach and reduce in the public API

back2dos commented 3 years ago

Oh, yeah. In the public API they should be separate things. My point is rather that implementing reduce over forEach is actually trickier than the other way around.