3 ms·
Interestingly, after a relatively quick check, it seems that the tail recursive conversion is actually simpler and more predictable than in the non-recursive ca
by throwaway17_17 3y ago
Interestingly, after a relatively quick check, it seems that the tail recursive conversion is actually simpler and more predictable than in the non-recursive case. For recursive calls the stack size is always the same between the caller and callee so refactoring of the recursive function is less likely to produce errors. In the general case, where caller/callee stacks are different sizes the algorithm requires more effort and analysis to ensure the proper stack adjustments are made, and such algorithms are seemingly going to more finicky with regards to changes in either function.
This certainly seems to be one of those times when my gut instinct was just absolutely backwards, so thanks for the response which prompted me to actual check my assumptions.