Computer Dictionary Online

Medical Dictionary   Law Dictionary   Legal Dictionary   Website Design

0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z 


tail recursion

<programming> 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]

(1996-02-22)


Contact the Computer Dictionary Online  ::  Link to the Computer Dictionary Online  ::  Disclaimer for Computer Dictionary Online

Computer Dictionary Online
Copyright © 2017