Summary
In this chapter, we saw how we can use recursion, a basic tool in FP, as a powerful technique to create algorithms for problems that would probably require far more complex solutions otherwise. We started by considering what recursion is and how to think recursively in order to solve problems, then moved on to see some recursive solutions to several problems in different areas, and ended by analyzing potential problems with deep recursion and how to solve them.
In Chapter 10, Ensuring Purity, we shall get back to a concept we saw earlier in the book, function purity, and see some techniques that will help us guarantee that a function won’t have any side effects by ensuring the immutability of arguments and data structures.