3 ms·
From the other side, tail call recursion is often actually implemented as a loop by the interpreter. Effectively, making many recursive programs just a differe
by Retric 7y ago
From the other side, tail call recursion is often actually implemented as a loop by the interpreter. Effectively, making many recursive programs just a different way to write a loop.
- madhadron 7y agoUnder the hood it's all conditional jump instructions whether it's tail recursion, loops, or if/else expressions.
- stcredzero 7y agoIs there an alternative to conditional jump instructions? What would a such a computer look like? Maybe such a computer exists, but it's hard for us to see it, because we've been drawn into thinking along Von Neumann machine lines.
- opwieurposiu 7y agoThere other ways to do it, but they tend to be less efficient. https://github.com/xoreaxeaxeax/movfuscator https://github.com/xoreaxeaxeax/movfuscator
- ksherlock 7y agoindexed jump instructions? (where the index is a boolean value corresponding to the if condition...)
- Retric 7y agoSeveral CPU’s had specific loop instructions. These are slow on x86, but where sometimes useful on other CPU’s. Though this is half remembered second hand info, so your mileage may very.
- madhadron 7y agoYou're absolutely right. I'm usually careful about being blinded by current machines. And there are other ways like changing your return stack manually which could be used to loop. I was trying to express that the various mathematical formalisms we think in are all getting translated to the same machine in the end.