April 2018
Intermediate to advanced
284 pages
5h 46m
English
| Tip 35 | Combine Currying and Array Methods for Partial Application |
In this tip, you’ll learn to lock in variables with partial application of functions.
In the previous tip, you saw how you can give parameters a single responsibility with higher-order functions and partial application. It solved the problem of having unrelated parameters, but it didn’t solve the problem of using the same parameters over and over. You still passed in the same parameters multiple times.
With higher-order functions, you can avoid repetition by creating a new function with values you lock in once and use later. When you return a higher-order function, you don’t have to invoke it right away. After you invoke it once, you have another pre-made function that you can ...
Read now
Unlock full access