News for hackers. Stuff that matters.
Re:Tail Call Optimization: The Musical by codetrotter on Sunday January 08, 2023 @08:52AM (#34299086)
> Otherwise you'd have to explicitly code a loop where you would much rather use recursion.

I find it much easier to reason about loops than to reason about recursion. Likewise I find it much easier to write loops than to write recursive functions.

It probably comes down to experience mainly. I spent some time with functional languages, but I have spent far far far more time writing imperative procedural code.

Re:Tail Call Optimization: The Musical by jacquesm on Sunday January 08, 2023 @09:31AM (#34299379)
Even a simple problem such as the 'Towers of Hanoi' looks to me like a pretty messy solution when done with loops and with recursion it all just falls into place.
Re:Tail Call Optimization: The Musical by Jensson on Sunday January 08, 2023 @11:47AM (#34300619)
Recursion is great due to the implicit stack. The cases where you don't have an implicit stack, ie where tail call optimization works, are usually easier and much clearer to just do in a loop.