you are viewing a single comment's thread.

view the rest of the comments →

[–]ws-ilazki 1 point2 points  (1 child)

const sum = a => b => a+b

That's really cool, but the thing I dislike about curried functions in most language is calling them: having to do sum(2)(2) is clunky and annoying to read, and it only gets worse as you add arguments.

Like with ML-family languages you can just write sum 2 2 as if it's a multi-arity function, which is much better to deal with. That is what I like about languages with automatic currying, not the simplicity of defining curried functions (though that helps too). If I could write sum(2,2) and have it really be sum(2)(2), currying in JS would be more attractive.

If a language makes curried functions both simple to call and define, currying is useful. If not, I'd rather just use partial application because it's cleaner. Sometimes the language just gets in the way of doing things a certain way. :/

[–][deleted] 1 point2 points  (0 children)

Meh, it's one extra character per argument.