Summary
In this chapter, we learned a new viewpoint on making use of C++. It may be used as a functional programming language since it is a multi-paradigm language.
We studied the fundamentals of functional programming, including folding, higher-order functions, and pure functions. Pure functions are those that don’t alter the state of the system. One advantage of pure functions is that they don’t create as many bugs as state modifications do.
Higher-order functions are functions that take or return other functions. Other than in functional programming, C++ programmers use higher-order functions when dealing with the STL.
Pure functions, along with higher-order functions, allow us to decompose the whole application into a big assembly line of functions. Each function in this assembly line is responsible for receiving data and returning a new, modified version of the original data (without mutating the original state). When combined, these functions provide a...