Chapter 5. Hello Recursion!

Some readers accustomed to imperative and object-oriented programming languages might be wondering why we haven’t covered loops already. The answer to this is a question: What is a loop? The truth is that functional programming languages usually do not offer looping constructs like for and while. Instead, functional programmers rely on a silly concept called recursion, which is the topic of this chapter.

image with no caption

How Recursion Works

Recall how invariable variables were explained in Chapter 1 (if you can’t, reread Invariable Variables in Invariable Variables). Recursion can also be explained with the help of mathematical concepts ...

Get Learn You Some Erlang for Great Good! now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.