4 ms·
I see what you're getting at with (B), since you've named the function which adds another 'thing' to think about. But I can anonymise it in modern Javascript:
by delibes 9y ago
I see what you're getting at with (B), since you've named the function which adds another 'thing' to think about. But I can anonymise it in modern Javascript:
y = (x) => {return Math.max(2, x)}
To me that just looks nice, and it's clear how Math.max is being used. With the partial (A) I have to have some implicit knowledge of the function, where as in (B) or my version I can see how it's being used. Perhaps I'm a bit dis-functional.
- lmm 9y agoI mean, => is standard in the language and partial isn't, but that's an accident of history. Your example looks reasonably nice, but the "x" isn't really adding anything; if we could somehow write it as y = => {Math.max , 2} that would be clearer still (setting aside familiarity with the language). Whether "=>" or "partial" is a better name is a separate question.