« Blog » 2007-07-09

Chasing tail

Created 2007-07-09T17:22:18.958Z, last edited 2007-07-09T17:31:22.561Z

ndanger.organism points out I explain a minor point about the Scheme language specification to Chris Diggins:

Kirit’s comment points out that the Scheme code is necessary to make the function tail recursive.

I don't know Scheme, but I do know the tail recursive requirements in the language specification because I researched them for Recursive rights and wrongs.

The question that I have though is, “Just how far do you have to go to convince the compiler that it's tail recursive?”

When I originally wrote Recursive rights and wrongs I said that the forms that I was using where {{Recursive rights and wrongs/Recursive rights and wrongs}tail recursive}. Any inspection of the code could tell that they weren't tail recursive, at least not canonically so. But the transformation seemed so trivial to me that I described it that way anyway.

So this begs the question, “How smart are compilers these days?”

What scares me about the possible answers is the amount of code that I have written where I think the optimising transformations are obvious… Is all my code belong to slow?