Questions tagged [tail-call-optimization]

For questions about implementation of an optimization where function calls whose value is immediately returned replace their caller's activation record in the call stack, allowing unlimited recursion in constant space.

Filter by
Sorted by
Tagged with
4 votes
1 answer

Effective Tail Call Optimization in Non strict functional languages

In functional programing languages it is normal to optimize forms like factorial n = go n 1 where go 0 acc = acc go n acc = go (n - 1) (acc * n) ...
Delfin's user avatar
  • 159
8 votes
3 answers

Tail-recursive detection and conversion

Motivation I have implemented the tail recursion optimization for my language, where a return statement calls itself by goto ...
Aster's user avatar
  • 3,107
15 votes
3 answers

What are the trade-offs in supporting Tail Recursion Optimization, but not Tail Call Optimization?

Tail Call Optimization allows a function call as the returned value of a function to be optimized to a goto, preventing the stack from growing. Among other things, ...
Rydwolf Programs's user avatar
12 votes
2 answers

Which calling convention should my compiler use?

The LLVM-IR Reference Manual's section on Calling Conventions lists as many as 15 supported calling conventions. These vary in ways including whether they support tail call optimization, how many and ...
Rydwolf Programs's user avatar