What Is a Tail Call?
A tail call is a call that occurs as the very last operation of a function, so nothing remains to do after it returns except return its result. Because the caller frame is no longer needed, an implementation can reuse it for the callee rather than pushing a new one. This is the property that enables tail call optimization.
Why it matters
Recognizing tail calls lets compilers turn recursion that would overflow the stack into loop-like iteration. It is the basis for writing deep recursive algorithms safely in functional styles.
Related guides
What Is Tail Call Optimization?Tail call optimization reuses the current stack frame for a call in tail position, so deeply recursive tail c…
What Is a Stack Frame?A stack frame is the block of stack memory for one function call, holding its arguments, local variables, and…
What Is a Continuation?A continuation represents the rest of a computation at a given point, as a value that can be invoked later to…