News for hackers. Stuff that matters.
Re:What's so great about Reducers? by moomin on Sunday December 01, 2013 @03:53PM (#6829264)
Actually, I think what you're really asking for is the ability to write sequential code and have the compiler work out if it could be parallel. It's true that the reducers implementation runs in parallel, but the API is actually agnostic.

Reducers also provide higher level constructs like filter, map, cat (concatenate), take-while, and of course reduce.

Re:What's so great about Reducers? by derefr on Sunday December 01, 2013 @10:32PM (#6831367)
> Actually, I think what you're really asking for is the ability to write sequential code and have the compiler work out if it could be parallel.

Nah; the ability to write parallel code and have the compiler work out how to make it sequential-when-necessary would be better. Like JITing an agent-based system into bits of single-threaded procedural code.

Re:What's so great about Reducers? by lazyjones on Sunday December 01, 2013 @05:10PM (#6829628)
> what you're really asking for is the ability to write sequential code and have the compiler work out if it could be parallel

Not really. I don't care how I have to specify the desired computation, as long as it isn't excessively verbose and doesn't require me to nail down implementation details I don't care about - for example, a for-loop (from 1 to 1 million as in the accumulator example) specifies a particular traversal (index 1 to 1 million in ascending order), but for an implementation of "sum" I only need "for each element" (no particular order) semantics. I don't want to even think about whether by using such an (overly specific) loop, I'm making the code difficult or impossible to parallelize (in the presence of some side effects, for example in C, it will likely be).

Re:What's so great about Reducers? by moomin on Monday December 02, 2013 @02:19PM (#6835818)
Actually, no, for sum you need three things: how to start (0), how to accumulate (plus) and how to combine two reductions (plus again). This is exactly what fold doe

Equally, for filter, it's empty list, conj or not and concat. (Just to demonstrate that sometimes the combine is different from the accumulate stage.)