3 ms·
"One of the advantages of the "slightly better", more imperative, method of finding a 3D piece under the mouse over the "beautiful", more functional, one is tha
by jimbokun 11y ago
"One of the advantages of the "slightly better", more imperative, method of finding a 3D piece under the mouse over the "beautiful", more functional, one is that it is extremely clear what the code is doing, while the functional case needs some thought to understand; even for someone who knows what map, filter, etc. do!"
This is not at all self evident. See map and immediately think "oh, this will invoke the function once for each item and collect the results". See filter and think "oh, this will invoke the function once for each item and collect the ones for which the function returned true".
What about that is not extremely clear?
- sanderjd 11y agoI find this sort of functional-style code much easier to skim, because there are more obvious keywords with immediate connotations, rather than each line of code potentially doing something bespoke.