October 2023
Intermediate to advanced
384 pages
9h 12m
English
In Chapter 1, Immutability, I stated that functional programming makes use of recursion in order to eliminate assignment. In this chapter, we will look at the two different varieties of recursion; one we will call iteration and the other will retain the original name: recursion.
TCO is the remedy for the infinite stack depth implied by infinite recursive loops. However, TCO is only applicable if the recursive call is the very last thing to be executed within the function. Such functions are often called tail call functions.
Here is a very traditional implementation of a function to create a list of Fibonacci ...
Read now
Unlock full access