In Chapter 6, Producing Functions – Higher-Order Functions, we saw several ways of manipulating functions, to get new versions with some change in their functionality. In this chapter, we will go into a particular kind of transformation, a sort of factory method, that lets you produce new versions of any given function, with some fixed arguments.
We will be considering the following:
- Currying: A classic FP theoretical function that transforms a function with many parameters into a sequence of unary functions.
- Partial application: Another time-honored FP transformation, which produces new versions of functions by fixing some of their arguments.
- Partial currying (a name of my own): Can be seen as a mixture of the two previous transformations.
To be fair, we'll also see that some of these techniques can...