If you thought that pure functions and lambdas are powerful, you will now realize how much you can do by composing them! In this chapter, you learned what functional composition is and how to compose functions in C++.
We also worked on something much more important. In this chapter, we really started to think in functions. Here are some things we learned:
- A lambda is just a value, so we can have functions that return lambdas, or lambdas that return lambdas.
- Also, we can have functions that receive one or more lambdas and return a new lambda.
- Any function with multiple arguments can be decomposed into multiple lambdas with single arguments and captured values.
- Operations with functions are quite complex. If you feel your head spinning, that's OK—we've been playing with very powerful and abstract concepts.
- It's very difficult to instantly come up with...