tail recursion

Computing Dictionary

tail recursion definition

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)
In this example both calls to f are recursive but only the outer one is tail recursive.
Tail recursion is a useful property because it enables tail recursion optimisation.
If you aren't sick of them already, see recursion and tail recursion.
[Jargon File]
(2006-04-16)

The Free On-line Dictionary of Computing, © Denis Howe 2010 http://foldoc.org
Cite This Source

00:10

00:09

00:08

00:07

00:06

00:05

00:04

00:03

00:02

00:01

Tail recursion is always a great word to know.
So is interrobang. Does it mean:
a printed punctuation mark (‽), available only in some typefaces, designed to combine the question mark (?) and the exclamation point (!), indicating a mixture of query and interjection, as after a rhetorical question.
an extraordinary or unusual thing, person, or event; an exceptional example or instance.
Dictionary.com, LLC. Copyright © 2012. All rights reserved.
  • Please Login or Sign Up to use the Recent Searches feature