3 ms·
> Now you’re just being patronising. Jesus Christ, I was just trying to be nice. Your defensiveness is repeatedly leading to misunderstanding and getting in th
by dahart 2y ago
> Now you’re just being patronising.
Jesus Christ, I was just trying to be nice. Your defensiveness is repeatedly leading to misunderstanding and getting in the way of us having a productive conversation.
> Right, so now we’re talking about unbounded iteration?
You’re conflating multiple different topics here. NASA doesn’t allow unbounded iteration. That’s a separate topic from whether recursion can theoretically be transformed into iteration.
Recursion can always be transformed into iteration. That statement is not and never was dependent on what NASA does. There is no such thing as a recursive function that can’t be iterated. In practice, iterating is as efficient or more efficient than using a call stack. This is still and always was my point. If you’re using a call stack for recursion, you are wasting memory and cycles, which is one of the reasons “Software developed in Prolog has been criticised for having a high performance penalty compared to conventional programming languages.” https://en.wikipedia.org/wiki/Prolog#Limits https://en.wikipedia.org/wiki/Prolog#Limits
I work on ray tracing hardware, which is conceptually recursive, uses recursive tree data structures, and often implemented using recursion. We make it faster by transforming the recursion into specialized iterative hardware, and also algorithms that do iteration in place of recursion. Computer graphics is full of algorithms that are conceptually recursive and yet always more efficient in practice if you avoid using call recursion and implement them iteratively instead. Character rig animation is one example. And browsers do this for rendering HTML.