Hacker News new | ask | show | jobs
by hackbinary 2555 days ago
I'm still not a fan of tail regression, er, recursion.
4 comments

Why not? The recursive call gets optimized away, so it's just as fast as a loop.
good news: For 99.9% of use cases, you can use the Enum module.
I would perhaps agree that having to structure the code in such a way that TCO is "triggered" can be a hassle, but once you realize the pattern and learn it, it's not hard at all to refactor your code to trigger TCO. And it allows you to enjoy the semantics of an infinitely-deep stack without actually needing an infinitely-deep stack :)
Why not? I've always enjoyed it in languages that support it.