|
|
|
|
|
by rothron
2817 days ago
|
|
Don't see the point really. Languages without tail recursion will perform worse. Memoization is borderline cheating, because it's a different implementation. Fib is the poster boy for tail recursion but the reason for that is that recursion to implement fib is simply a bad choice. It's cute but that's about it. If the point is to measure function call overhead, then measure _that_? |
|
But recursive Fibonacci isn't tail recursive. The final function call is to `+` (addition), which means that the two recursive calls must each be put on the stack and later returned so the sum can be computed. Tail recursion requires that there is no final operation other than exactly a single recursive call.