Recursion
In this chapter, we are going to talk about recursion. This is a topic that all programmers encounter sooner or later, as it’s not exclusive to the functional paradigm. Any language in which you can express function calls allows you to express functions that are recursive in nature. For many, it is not a topic that is difficult to understand at first. In functional programming languages such as Haskell, recursion takes center stage.
As such, this chapter is dedicated to understanding exactly how recursion works, including what the performance implications are of doing so, and what the limits of recursion are in Go. We’ll also take a look at some handy constructs for dealing with recursion using functions as first-class citizens.
In this chapter, we will cover these main topics:
- What recursion means
- Why use recursive functions?
- When and how to use recursive functions
- Leveraging functions as first-class citizens to write recursive functions...