Re:SICP Goodness – Why you don't need looping constructs
by gpderetta on Friday June 29, 2018 @08:32AM
(#17424099)
of course you can, and trivially so; just return the next function to call from (as a pointer or some other identifier as a result of each state function.
[ Parent
| on HN ]
Re:SICP Goodness – Why you don't need looping constructs
by noelwelsh on Friday June 29, 2018 @08:35AM
(#17424115)
That's called a trampoline, and is one of the ways to simulate tail recursion. It requires a global modification to the code: you have to rewrite all your code that you want to be stack-safe to be trampolined. It wouldn't call that trivial, but then Node developers are happy to rewrite their code into CPS so what do I know.