Not only, but it better separates the code term (one) from the input terms (two of them).
In my version, you can see that all the long consecutive block:
(
(hi) =>
(
(dev) => `${hi} ${dev}`
)
)
is the code term as a whole, and the next two terms are inputs.
Getting all the "input" as a whole ensures portability (that is, you can take that self-sufficient code and use somewhere else).
For any novice reader of my reply: in JavaScript (and, more in general, in classical lambda-calculus theory), the convention is to left-associate terms together in more-than-two-items sequences, so the two input terms cannot be grouped in one term only (like we did for the code one).
A fully parenthesiszed equivalent expression would be:
The outermost parentheses, in my notation, indicates that we want to reduce (or, in classical programming languages speaking, to run) what's inside of them.
Regarding my first reply, I was just comparing your version of the invocation code (the one with the 'dev.to' term inside the function to be returned) with this other invocation foo('hey')('dev.to')
you wrote right before.
Simply, my version applies the arguments like this 😊.
Regards.
Now I see, I was looking at the Going Deep example where I intentionally wanted to nest the arguments, so that the example resembles more closely the Anonymous Recursion one below it.
I should probably update the example in the Closures chapter. Thanks for the feedback!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
That would work too. And it's looking good.
Not only, but it better separates the code term (one) from the input terms (two of them).
In my version, you can see that all the long consecutive block:
is the code term as a whole, and the next two terms are inputs.
Getting all the "input" as a whole ensures portability (that is, you can take that self-sufficient code and use somewhere else).
For any novice reader of my reply: in JavaScript (and, more in general, in classical lambda-calculus theory), the convention is to left-associate terms together in more-than-two-items sequences, so the two input terms cannot be grouped in one term only (like we did for the code one).
A fully parenthesiszed equivalent expression would be:
indeed.
The outermost parentheses, in my notation, indicates that we want to reduce (or, in classical programming languages speaking, to run) what's inside of them.
Regarding my first reply, I was just comparing your version of the invocation code (the one with the 'dev.to' term inside the function to be returned) with this other invocation
foo('hey')('dev.to')
you wrote right before.
Simply, my version applies the arguments like this 😊.
Regards.
Now I see, I was looking at the Going Deep example where I intentionally wanted to nest the arguments, so that the example resembles more closely the Anonymous Recursion one below it.
I should probably update the example in the Closures chapter. Thanks for the feedback!