January 2020
Intermediate to advanced
470 pages
11h 13m
English
Now that we are nearing the end of this chapter, a confession is in order: I do not always use currying and partial application as shown above! Don't misunderstand me, I do apply those techniques—but sometimes it makes for longer, less clear, not necessarily better code. Let me show you what I'm talking about.
If I'm writing my own function and then I want to curry it in order to fix the first parameter, currying (or partial application, or partial currying) doesn't really make a difference, in comparison to arrow functions. I'd have to write the following:
const myFunction = (a, b, c) => { ... };const myCurriedFunction = curry(myFunction)(fixed_first_argument);// and later in the code...myCurriedFunction(second_argument)(third_argument); ...