Global Information Lookup Global Information

Tail call information


In computer science, a tail call is a subroutine call performed as the final action of a procedure.[1] If the target of a tail is the same subroutine, the subroutine is said to be tail recursive, which is a special case of direct recursion. Tail recursion (or tail-end recursion) is particularly useful, and is often easy to optimize in implementations.

Tail calls can be implemented without adding a new stack frame to the call stack. Most of the frame of the current procedure is no longer needed, and can be replaced by the frame of the tail call, modified as appropriate (similar to overlay for processes, but for function calls). The program can then jump to the called subroutine. Producing such code instead of a standard call sequence is called tail-call elimination or tail-call optimization. Tail-call elimination allows procedure calls in tail position to be implemented as efficiently as goto statements, thus allowing efficient structured programming. In the words of Guy L. Steele, "in general, procedure calls may be usefully thought of as GOTO statements which also pass parameters, and can be uniformly coded as [machine code] JUMP instructions."[2]

Not all programming languages require tail-call elimination. However, in functional programming languages, tail-call elimination is often guaranteed by the language standard, allowing tail recursion to use a similar amount of memory as an equivalent loop. The special case of tail-recursive calls, when a function calls itself, may be more amenable to call elimination than general tail calls. When the language semantics do not explicitly support general tail calls, a compiler can often still optimize sibling calls, or tail calls to functions which take and return the same types as the caller.[3]

  1. ^ Steven Muchnick; Muchnick and Associates (15 August 1997). Advanced Compiler Design Implementation. Morgan Kaufmann. ISBN 978-1-55860-320-2.
  2. ^ Cite error: The named reference aim-443 was invoked but never defined (see the help page).
  3. ^ "The LLVM Target-Independent Code Generator — LLVM 7 documentation". llvm.org.

and 21 Related for: Tail call information

Request time (Page generated in 0.812 seconds.)

Tail call

Last Update:

In computer science, a tail call is a subroutine call performed as the final action of a procedure. If the target of a tail is the same subroutine, the...

Word Count : 4209

Goto

Last Update:

the tail call optimizations discussed by Steele turned the procedure into a credible way of implementing iteration through single tail recursion (tail recursion...

Word Count : 5906

Stack overflow

Last Update:

implement tail-call optimization, allowing infinite recursion of a specific sort—tail recursion—to occur without stack overflow. This works because tail-recursion...

Word Count : 958

Tail

Last Update:

The tail is the section at the rear end of certain kinds of animals' bodies; in general, the term refers to a distinct, flexible appendage to the torso...

Word Count : 1209

Functional programming

Last Update:

Scheme was the first dialect of lisp to use lexical scoping and to require tail-call optimization, features that encourage functional programming. In the 1980s...

Word Count : 8792

Fairy Tail

Last Update:

Fairy Tail (stylized in all caps) is a Japanese manga series written and illustrated by Hiro Mashima. It was serialized in Kodansha's Weekly Shōnen Magazine...

Word Count : 7693

Comet tail

Last Update:

A comet tail and coma are visible features of a comet when they are illuminated by the Sun and may become visible from Earth when a comet passes through...

Word Count : 1207

Stack trace

Last Update:

interfere with the call stack information that can be recovered at runtime. For instance, inlining can cause missing stack frames, tail call optimizations...

Word Count : 1060

Procedural programming

Last Update:

least since Algol 68. Functional programming languages tend to rely on tail call optimization and higher-order functions instead of imperative looping...

Word Count : 985

Continuation

Last Update:

used to implement tail call elimination. One generalization of continuations are delimited continuations. Continuation operators like call/cc capture the...

Word Count : 3049

Aviation call signs

Last Update:

using the call sign corresponding to the aircraft's registration number (also called N-number in the U.S., or tail number). In this case, the call sign is...

Word Count : 1914

Mutual recursion

Last Update:

of tail-recursive call optimization, and thus efficient implementation of mutual tail recursion may be absent from languages that only optimize tail-recursive...

Word Count : 2013

Coroutine

Last Update:

in tail position; mutually recursive subroutines must either use shared variables or pass state as parameters. Further, each mutually recursive call of...

Word Count : 4991

Long tail

Last Update:

In statistics and business, a long tail of some distributions of numbers is the portion of the distribution having many occurrences far from the "head"...

Word Count : 5942

Quicksort

Last Update:

used, recur first into the smaller side of the partition, then use a tail call to recur into the other, or update the parameters to no longer include...

Word Count : 9985

Quickselect

Last Update:

requiring only constant memory overhead if tail call optimization is available, or if eliminating the tail recursion with a loop: function select(list...

Word Count : 1163

Prolog

Last Update:

optimization method called tail call optimization (TCO) for deterministic predicates exhibiting tail recursion or, more generally, tail calls: A clause's stack...

Word Count : 8053

Prolog syntax and semantics

Last Update:

optimization technique called tail call optimization (TCO) for deterministic predicates exhibiting tail recursion or, more generally, tail calls: A clause's stack...

Word Count : 1964

Empennage

Last Update:

The empennage (/ˌɑːmpɪˈnɑːʒ/ or /ˈɛmpɪnɪdʒ/), also known as the tail or tail assembly, is a structure at the rear of an aircraft that provides stability...

Word Count : 1861

Escape analysis

Last Update:

implementation uses tail call optimization (usually required for functional languages), objects may also be seen as escaping to called subroutines. If a...

Word Count : 1024

An American Tail

Last Update:

An American Tail is a 1986 American animated musical adventure comedy-drama film directed by Don Bluth and written by Judy Freudberg and Tony Geiss from...

Word Count : 6296

PDF Search Engine © AllGlobal.net