So far, we've seen how some of the classic object-oriented design patterns can be turned into a functional variant. But can we imagine design patterns that stem from functional programming?
Well, we've actually already used some of them. map/reduce (or transform/accumulate in STL) is one example. Most of the higher-order functions (such as filter, all_of, and any_of, among others) are also examples of patterns. However, we can go even further and explore a common, but opaque, design pattern that comes from functional programming.
The best way to understand it is by starting from specific problems. First, we'll see how we can maintain state in an immutable context. Then, we'll learn about the design pattern. Finally, we'll see it in action in another context.