Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Tail call optimization is the specific use of tail calls in a function or subroutine that eliminate the need for additional stack frames. Tail call optimization can be part of efficient programming and the use of the values that subroutines return to a program to achieve more agile results or use fewer resources.
Tail call optimization is also known as last call optimization.
In tail call optimization, the end value returned by the subroutine is used in a particular way. This tail call, the last value or result to be returned, may get funneled into an additional subroutine involving a particular function call. When the tail call results in the same subroutine being run again, this is referred to as tail call recursion.
Tail call optimization can be a part of best practices for programming. In general, the use of the tail call is a specific technique that engineers and developers can use to affect the final quality of code, for example, the length of a program or its clarity and transparency.