Recursive calls and stack
Neil Cerutti
horpner at yahoo.com
Thu Feb 15 15:44:28 EST 2007
On 2007-02-15, Gabriel Genellina <gagsl-py at yahoo.com.ar> wrote:
>> I'm not sure what you mean. The above support is enough for
>> tail recursion, mutual recursion, and any other tail call to
>> be "optimized."
>
> I only want to say that tail *recursion* can be eliminated
> trivially transforming the code into a while loop, and that
> can be done by the programmer, and doesn't require compiler
> support. Head *recursion* can be eliminated too by using some
> storage as temporary stack, and that doesn't require external
> support either. Mutual recursion (and generic tail call
> elimination) require some sort of external support: one can't
> eliminate the call just by transforming the program.
Ah, I see now. Had my blinders on.
--
Neil Cerutti
Low Self-Esteem Support Group will meet Thursday at 7 to 8:30 p.m. Please use
the back door. --Church Bulletin Blooper
More information about the Python-list
mailing list