4 ms·
Tail Recursion Elimination
- ggm 2y ago> Third, I don't believe in recursion as the basis of all programming. This is a fundamental belief of certain computer scientists, especially those who love Scheme and like to teach programming by starting with a "cons" cell and recursion. But to me, seeing recursion as the basis of everything else is just a nice theoretical approach to fundamental mathematics (turtles all the way down), not a day-to-day tool. The point of substance. He doesn't believe in the fundamentals behind tail recursion because he doesn't believe in the fundamentals behind recursion.
- mrkeen 2y ago> Is it really such a big deal to rewrite your function to use a loop? My problem with that is I don't know how to do something as simple as a summation, without first writing down the wrong answer, and then iteratively overwriting it until it's the right answer. How does that gel with maximally debuggable? I'm gonna see sum=0 while stepping through. That violates some invariant right? Nah, I'll just keep stepping and maybe it'll be the right number later.