Designing Functions – Recursion
In Chapter 8, Connecting Functions, we considered yet more ways to create new functions out of combining previous existing ones. Here, we will get into a different theme: how to design and write functions in a typically functional way, by applying recursive techniques.
We will be covering the following topics:
- Understanding what recursion is and how to think in order to produce recursive solutions
- Applying recursion to some well-known problems, such as making a change or the Tower of Hanoi
- Using recursion instead of iteration to re-implement some higher-order functions from earlier chapters
- Writing search and backtrack algorithms with ease
- Traversing data structures, such as trees, to work with filesystem directories or with the browser DOM
- Understanding mutual recursion and applying it to problems such as correctly evaluating arithmetical expressions
- Getting around some limitations caused by browser JavaScript...