So far, we've seen how we can write functions that compose lambdas in various ways. But code tends to repeat itself, so we would like to make this method more general. We can indeed take this even further; let's look at a few examples.
Using functional composition to remove duplication
Generalizing incrementResultOfMultiplication
Let's take another look at our incrementResultOfMultiplication lambda:
auto incrementResultOfMultiplication = [](int first, int second) {
return compose(increment, decomposeToOneParameter(multiply)
(first))(second);
};
There's something interesting about it—it's not specific to increment and multiply. Since lambdas are just values, we can pass them as...