Hacker News new | ask | show | jobs
by m0skit0 4986 days ago
I have to diagree with your PoV for recursion. I personally don't have any problems if an alogrithm is iterative or recursive, specially if the recursivity is as simple as in your example. In fact, in such cases recursivity is even simpler to understand than iteration IMHO.
1 comments

I came here to say something similar. I would go further and assert that once you're comfortable with recursion it's nearly always preferable where reasoning about execution is the primary concern. Discarding the mental overhead associated with index accounting and temporary variable state has a lot of value.