Prolog Language Performance Tail call optimization


Example

Virtually all Prolog systems implement tail call optimization (TCO). This means that predicate calls that are in a tail position can be executed in constant stack space if the predicate is deterministic.

Tail recursion optimization (TRO) is a special case of tail call optimization.