2 ms·
When I'm doing FP, rather than making a long chain, I assign at each step, then call the next one. As you've shown above. Sometimes I even comment on why the co
by edoceo 1y ago
When I'm doing FP, rather than making a long chain, I assign at each step, then call the next one. As you've shown above. Sometimes I even comment on why the code is doing stuff.
Making it read as a list of steps, helps me understand what it's doing a little easier than that long chain.
- monkpit 1y agoSame. Chaining all of those together does nothing useful, is arguably less readable, and the JIT will optimize out the intermediate assignments. So there’s not really any reason to do that big chain (unless you’re talking about HoC/composable functions, which this example is not).
- edoceo 1y agoFuture me has to re-solve this issue. And Past Me is an idiot. I gotta write code both those fools can understand.