3 ms·
its the only way to do loops without blowing your call stack in scheme. technically yes as long as you're not doing anything interesting
by cultofmetatron 4y ago
its the only way to do loops without blowing your call stack in scheme. technically yes as long as you're not doing anything interesting
- vishesh 4y agoCurrently, the compiler does a dumb conversion to JS for loop of self tail calls. So if you call `map` on list of 1000000 items, your stack wont blow up. But I understand it is not enough for many non-trivial codebases. We were interested in doing more general TCO, and had some ideas around using trampolines (or iirc detecting mutually recursions and then trying to generate potentially a bit faster code). Had limited time, and was maybe too hopeful that eventually TCO will actually be supported by browsers (as it is part of standard).