Possibly Pythonic Tail Call Optimization (TCO/TRE)

Marko Rauhamaa marko at pacujo.net
Wed Jul 15 05:55:18 EDT 2015


Gregory Ewing <greg.ewing at canterbury.ac.nz>:

> A tail call *is* a goto. That's how you implement one in assembly
> language -- you write a jump instruction instead of a call
> instruction. The jump doesn't have to be to the same function.

In functional programming languages you might not even have a call
stack. Instead, you specify the program execution through
transformations. When you evaluate a program, you repeatedly convert the
program text into new programs until no more transformations apply and
the execution halts with the result of the computation.


Marko



More information about the Python-list mailing list