Hyper Dictionary

English Dictionary Computer Dictionary Video Dictionary Thesaurus Dream Dictionary Medical Dictionary


Search Dictionary:  

Meaning of TAIL RECURSION

 
Matching Terms:  tail recursion modulo cons, tail recursion optimisation

Computing Dictionary
 
 Definition: 

When the last thing a function (or procedure) does is to call itself. Such a function is called tail recursive. A function may make several recursive calls but a call is only tail-recursive if the caller returns immediately after it. E.g.

        f n = if n < 2 then 1 else f (f (n-2) + 1)

Here the both calls to fib are recursive but only the outer one is tail recursive.

See tail recursion optimisation, and, if you aren't sick of them already, recursion, tail recursion.

[jargon file]

 

 

COPYRIGHT © 2000-2013 HYPERDICTIONARY.COM HOME | ABOUT HYPERDICTIONARY