More functional programming concepts
At the beginning of this chapter, we looked at general functional programming concepts, mainly higher-order functions and immutability. In this section, we will explore several more functional programming concepts and techniques—partial function application, currying, closures, monoids, and monads.
Partial function application
Partial function application is the process of taking a function with N parameters and one argument and returning another function with N-1 parameters after fixing the argument into one of the function's parameters. It is, of course, possible that the invocation is done with more than just one argument, say, M, in which case the returned function will have N-M parameters.
To understand how this works, let's start with a function that has several parameters and is returning a string (containing the value of the arguments):
string AsString(int a, double b, string c) { Â Â Â Â return...