Great article, Damien! There are just a few things I noticed in the definition of the curried function. return fn( ...args ) should be return func( ...args ), I think.
Also, I don't quite get why you're defining nextFunc as an argument to the curried function. Is it just to declare the variable so that you wouldn't have to explicitly declare it inside the arrow function body and leave out the brackets? Just a bit unclear to me.
I don't need to specify this third argument. My guess is ( and it's only a guess so far ) that the arrow functions somehow changes something in my implementation. I'll dig a bit more. Good question!
Great article, Damien! There are just a few things I noticed in the definition of the
curried
function.return fn( ...args )
should bereturn func( ...args )
, I think.Also, I don't quite get why you're defining
nextFunc
as an argument to thecurried
function. Is it just to declare the variable so that you wouldn't have to explicitly declare it inside the arrow function body and leave out the brackets? Just a bit unclear to me.Oh, you are right, it should be func and not fn. Thank you, I updated the code.
You know what, I actually have an issue with that. If I remove nextFunc from the arguments, I have an TypeError when I call my curried function.
But, when I implement my same curried function using the function keyword :
I don't need to specify this third argument. My guess is ( and it's only a guess so far ) that the arrow functions somehow changes something in my implementation. I'll dig a bit more. Good question!
And don't forget to also change the default value of
arity
fromfn.length
tofunc.length
:)