Hacker News new | ask | show | jobs
by lblume 252 days ago
Reduce can be very useful to signal that the state used is inherently limited. My rule of thumb is to use reduce when the state is a primitive or composed of at most two primitives, and a for loop otherwise. What counts as "primitive" depends on the language of choice and abstraction level of the program, of course.
1 comments

Fair observation, but just opening a local lexical scope (in an expression-oriented language) can help with that. Also ... something something ST monad :)