3 ms·
Would it be that impossible to keep a counter of what iteration of function X the user is on? Or, does tail recursion also count things like: int A() { return
by sukuriant 16y ago
Would it be that impossible to keep a counter of what iteration of function X the user is on? Or, does tail recursion also count things like:
int A() { return 1 + B(); }
int B() { return 1 + A(); }
(with necessary ending conditions)
- crux_ 16y agoYes, tail call optimizations include mutually recursive functions. Note that your example was not of tail calls, however. (Tail call would be: return A(...); that is, a tail call is one whose result is immediately returned.)
- sukuriant 16y agoThat does become harder to follow, then. And, woops...