Hacker News new | ask | show | jobs
by mrami 2914 days ago
To be fair, Scheme implements tail recursion, which converts properly prepared recursion into an iterative loop. Usually converting the recursive call into a GOTO. So if used correctly, recursion in scheme isn't a stack issue.

That said, I love my for loops, too.

1 comments

> which converts properly prepared recursion into an iterative loop

It only works if you are using recursion in place of a simple loop.

Many algorithms traditionally implemented with recursion (e.g. various tree searches) need that stack somewhere.

Technically it’s probably possible to “properly prepare” that, but practically both alternatives (recursion + built-in call stack, or loop + separate stack) are much easier to implement.