3 ms·
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
by lblume 1y 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.
- Quekid5 1y agoFair observation, but just opening a local lexical scope (in an expression-oriented language) can help with that. Also ... something something ST monad :)