... But I'm pretty sure the answer is no, unless it is tail recursive.
What's tail recursive, you say?
Tail recursive is when the recursive call is the very last thing that happens in the procedure. E.g. quicksort would *not* be tail recursive, for example. In such a case, instead of making an explicit call to the function, you just overwrite your parameter values, and goto the top of the function.
Scheme will generally automatically convert tail-recursive algorithms into iterative ones. I don't know about any other programming languages, though. Some C compilers have been known to do it, as well. |