This article delves into the differences between tail recursion and regular recursion, exploring concepts such as continuations, CPS, and trampolines with examples in Python and Clojure. Tail recursion involves the recursive call being in the last position before returning the result. Mutual recursion, like determining odd or even numbers, can be implemented using tail calls. Recursive solutions can be elegant but may result in stack overflow, especially with multiple recursive calls. Tail call optimization (TCO) can automatically eliminate stack buildup in some languages but not in others like Python. Continuations in CPS can mimic unbounded continuations in languages that do not support them, allowing for tail-recursive transformations of functions like Factorial and Fibonacci.
https://eli.thegreenplace.net/2017/on-recursion-continuations-and-trampolines/