6. Recursion and Looping
Overview
In this chapter, you will learn more flexible ways to work with collections. When the problem you need to solve does not fit the patterns that we've looked at so far. We will also use doseq
for loops with side effects and see how you can avoid writing some loops by using specialized repetition functions such as repeat
and iterate
. You will use recur
for recursive looping and identify when this is possible, work with the loop
macro, and solve complex problems with recursion.
By the end of this chapter, you will be able to implement different aspects of recursion and see how they can replace traditional loops.