|
|
Recursion versus iteration |
Recursive functions are sufficient - but typically memory inefficient - for programming of an iterative process. Tail recursive functions in Scheme are memory efficient for programming of any iterative process. |
|
A tail call is the last 'thing' to be done before the function returns. Therefore there is no
need to maintain any activation record of such a call - we can reuse the previous activation record.
The image series below will illustrate this.
|
|
|
|