Honestly speaking, I see the b => a => a * b pattern to be needlessly terse. Very rarely do I see that pattern (and sometimes, currying itself) serve any practical purpose other than trying to appear "functional". Just my 2c though, to each their own.
I understand, but variable naming was not my concern. The point is that most of the time this pattern is just used for the sake of currying itself i.e a => b => c => //imperative code with a, b and c anyway. In which case it's only easy to write, not read - a reader (like me) can be left with "yes but why??"
It's already arguable that we need both multiply and multiplyByTwo. Surely there are valid use cases out there, especially in term of function factories, I just don't see many of them in my experience.
We're a place where coders share, stay up-to-date and grow their careers.
One thing to consider is that thanks to arrow functions, this:
Can be turned into this:
And as you mentioned, the best about it is the partial application you can do:
Honestly speaking, I see the
b => a => a * b
pattern to be needlessly terse. Very rarely do I see that pattern (and sometimes, currying itself) serve any practical purpose other than trying to appear "functional". Just my 2c though, to each their own.Ideally that
a
and thatb
should have more significant names like:But having less boilerplate code (no
function
, noreturn
, no curly braces) makes it far easier to read.I understand, but variable naming was not my concern. The point is that most of the time this pattern is just used for the sake of currying itself i.e
a => b => c => //imperative code with a, b and c anyway
. In which case it's only easy to write, not read - a reader (like me) can be left with "yes but why??"It's already arguable that we need both
multiply
andmultiplyByTwo
. Surely there are valid use cases out there, especially in term of function factories, I just don't see many of them in my experience.