Recursive process and recursive procedure

In contrasting iteration and recursion, we must be careful not to confuse the notion of a recursive process with the notion of a recursive procedure. … One reason that the distinction between process and procedure may be confusing is that most implementations of common languages are designed in such a way that the interpretation of any recursive procedure consumes an amount of memory that grows with the number of procedure calls, even when the process described is, in principle, iterative. As a consequence, these languages can describe iterative processes only by resorting to special-purpose “looping constructs” such as do, repeat, until, for, and while. The implementation of Scheme we shall consider in chapter 5 does not share this defect. …

Tail recursion has long been known as a compiler optimazation trick. … Steele later showed how tail recursion is a consequence of the natural way to compile procedure calls. (Steele 1977)

—p35-36, The structure and interpretation of computer program

2024 © ak