4 ms·
Note that map and reduce (and generally fold) tell you what happens. Loops show you how something happens, and you have to infer a higher-level concept from it
by nine_k 8y ago
Note that map and reduce (and generally fold) tell you what happens. Loops show you how something happens, and you have to infer a higher-level concept from it yourself. That is, map belongs to a strictly more powerful language, but to benefit from it, you have to be fluent with this language.
The very same thing happened when structural programming was invented, and Fortran-iV guys were saying that all these "while" and "until" loops are harder to read than computed gotos.
- spc476 8y agoThis past week I sat in a class at work about the newer features of Java 8-10, mainly lambdas and streams. I was like "oh, Java is catching up I see" while another developer was like "What? I don't understand? How would you unit test a stream statement?"
- nine_k 8y agoStreams are reasonably testable; I wrote streams-heavy code for a year, and did not have issues with that. Very long streams can be combined of shorter stages, and these stages are individually testable, when needed.