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
- Something I'll call partial currying, that can be seen as a mixture of the two previous transformations
To be fair, we'll also see that some of these techniques can be emulated...