5 ms·
Constantly - it's so important that it's just kind of in the background of everything I do. Doesn't it make currying and point-free style much easier?
by eschutte2 8y ago
Constantly - it's so important that it's just kind of in the background of everything I do. Doesn't it make currying and point-free style much easier?
- madeuptempacct 8y agobut why? From first google search result (https://hackernoon.com/currying-in-js-d9ddc64f162e https://hackernoon.com/currying-in-js-d9ddc64f162e): function sum3(x) { return (y) => { return (z) => { return x + y + z; }; }; } console.log(sum3(1)(2)(3)) // 6 How is this cleaner than? sum(1,2,3); I have seen examples like this before, but I don't understand the point of this either. I guess I will read up on currying more, thank you.
- eschutte2 8y agoSorry, just got back and saw your reply. This is too big a topic to go into here and there's already plenty written on it. Sum is not a realistic use case. If you're doing Javascript, maybe look at lodash/fp for ways people really use currying. I think my answer to "why" would be: if your mind is already geared to think about problems in terms of composition of functions, then currying (for example) is just one necessary and natural thing that falls out of that.
- madeuptempacct 8y agoI appreciate you getting back to me!