4 ms·
Recursion without optimizations requires a possibly unbounded stack. Tail call optimization allows optimizing certain recursive functions in a way that no neste
by eddd-ddde 2y ago
Recursion without optimizations requires a possibly unbounded stack. Tail call optimization allows optimizing certain recursive functions in a way that no nested stack frames are needed.
So from a purely functional point of view, tail recursion and iteration are essentially a bijection.