| ▲ | andsoitis 2 hours ago | |
> Avoid recursion if possible to keep execution bounded and predictable, preventing stack overflows and uncontrolled resource use. In languages with TCO (e.g. Haskell, Scheme, OCaml, etc.) the compiler can rewrite to a loop. Some algorithms are conceptually recursive and even though you can rewrite them, the iterative version would be unreadable: backtracking solvers, parsing trees, quicksort partition & subprblems, divide-and-conquer, tree manipulation, compilers, etc. | ||
| ▲ | rerdavies an hour ago | parent [-] | |
Presumably why it says "Avoid recursion if possible". | ||