Next: , Previous: , Up: scheme basic   [Index]


3.5.11 Proper tail recursion

Implementations of Scheme must be properly tail–recursive. Procedure calls that occur in certain syntactic contexts called tail contexts are tail calls.

A Scheme implementation is properly tail–recursive if it supports an unbounded number of active tail calls. A call is active if the called procedure may still return. Note that this includes regular returns as well as returns through continuations captured earlier by call-with-current-continuation that are later invoked. In the absence of captured continuations, calls could return at most once and the active calls would be those that had not yet returned. A formal definition of proper tail recursion can be found in Clinger’s paper “Proper tail recursion and and space efficiency”. The rules for identifying tail calls in constructs from the (rnrs base (6)) library are described in section “Tail calls and tail contexts”.