Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let's disambiguate "tail calls" first.</p> <p>A <em>call in tail position</em> is a function call whose result is immediately returned as the value of the enclosing function. Tail position is a static property.</p> <p>A call in tail position can be implemented without pushing anything onto the stack, because the old stack frame is essentially useless (under assumptions that are generally true in functional languages but not necessarily in C, etc). As Guy Steele put it, a tail call is a jump that passes arguments.</p> <p>Roughly, a language implementation is <em>properly tail recursive</em> if it has the same asymptotic space usage as one that implements all calls in tail position as jumps without stack growth. That's a really rough simplification. If you want the full story, see Clinger's <a href="http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.50.4500" rel="noreferrer">Proper Tail Recursion and Space Efficiency</a>.</p> <p>Note that just handling <em>tail-recursive</em> functions specially is not enough to achieve proper tail recursion (<em>any</em> tail call must be specially handled). The terminology is somewhat misleading.</p> <p>Also note that there are other ways to achieve that asymptotic space efficiency without implementing tail calls as jumps. For example, you might implement them as normal calls and then periodically compact the stack by removing useless frames (somehow). See Baker's <a href="http://www.pipeline.com/~hbaker1/CheneyMTA.html" rel="noreferrer">Cheney on the MTA</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload