Summary
You learned about recursion and problems that are by nature, recursive. For example, directories on a Linux filesystem are defined this way. You also learned about recursive solutions, the general case, and the essential base case. The base case is needed so that the process eventually gets terminates. We also looked at Scala's slice and dice technique and how to split the list so that we can visit each element. We saw how recursive calls and associated context are remembered on stack frames and the need for tail recursion. We saw examples where tail recursion enables TCO. We looked at a detail example of a small expression parser. We looked at how recursive code promotes immutability, as we did not use var
in our code. We looked at persistent data structures and the two forms of recursion. Let's now move on to the wonders of Scala's power features for delayed evaluation.