Copyright © Philip M. Parker, INSEAD. Terms of Use.

| Domain | Definition |
Computing | Tail recursion n. If you aren't sick of it already, see tail recursion. Source: Jargon File. |
Math | (1) The last item of a list. (2) All but the first item of a list; the list following the head. (references) |
Source: compiled by the editor from various references; see credits. | |
(From Wikipedia, the free Encyclopedia)
Tail recursion is used in functional programming languages to fit an iterative process into a recursive function. Functional programming languages can typically detect tail recursion and optimize the execution into an iteration which saves stack space, as described below.
Take this Scheme program as an example (adapted from the Lisp programming language page to a more SICPish style):
(define (factorial n)
(define (iterate n acc)
(if (<= n 1)
acc
(iterate (- n 1) (* acc n))))
(iterate n 1))
As you can see, the inner procedure iterate calls itself last in the control flow. This allows an interpreter or compiler to reorganize the execution which would ordinarily look like this:
call factorial (3)
call iterate (3 1)
call iterate (2 3)
call iterate (1 6)
call iterate (0 6)
return 6
return 6
return 6
return 6
return 6
into the more space- (and time-) efficient variant:
call factorial (3) replace arguments with (3 1), jump into "iterate" replace arguments with (2 3), re-iterate replace arguments with (1 6), re-iterate replace arguments with (0 6), re-iterate return 6This reorganization saves space because no state except for the calling function's address needs to be saved, neither on the stack nor on the heap. This also means that the programmer need not worry about running out of stack or heap space for extremely deep recursions.
Some programmers working in functional languages will rewrite recursive code to be tail recursive so they can take advantage of this feature.
This often requires addition of an "accumulator" (acc in the above implementation of factorial) as an argument to a function.
In some cases (such as filtering lists) and in some languages, full tail recursion may require a function that was previously purely functional to be written such that it mutates references stored in other variables.
See also tail recursion modulo cons.
Source: adapted by the editor from Wikipedia, the free encyclopedia under a copyleft GNU Free Documentation License (GFDL) from the article "Tail recursion."
Crosswords: TAIL RECURSION |
| Specialty definitions using "TAIL RECURSION": collective recursion, conversion to iteration ♦ Id Nouveau ♦ last call optimisation ♦ tail recursion optimisation, TRO ♦ University of Edinburgh. (references) |
Source: compiled by the editor from various references; see credits. |
Expressions using "TAIL RECURSION": tail recursion modulo cons ♦ tail recursion optimisation. Additional references. | |
| Source: compiled by the editor from various references; see credits. |
Scrabble® Enable2K-Verified Anagrams | |
| Words within the letters "a-c-e-i-i-l-n-o-r-r-s-t-u" | |
-2 letters: ulcerations, unclarities, unrealistic. | |
-3 letters: contraries, criterions, curtailers, inoculates, inosculate, lacustrine, licentious, nucleators, raconteurs, relictions, ruralities, trinocular, ulceration, ultrasonic. | |
-4 letters: acroleins, airliners, anoretics, antiulcer, calutrons, carrioles, carrotins, carrousel, censorial, cilantros, cisternal, clarinets, clarities, coastline, coinsurer, consulate, consulter, contrails, countries, courantes, courtesan, courtiers, courtlier, creations, cretinous, criterion, curarines, cursorial, curtailer, elicitors, eristical, inclosure, inelastic, inoculate. | |
| Words containing the letters "a-c-e-i-i-l-n-o-r-r-s-t-u" | |
+1 letter: insurrectional, recirculations, relubrications, ultraprecision. | |
+2 letters: ultraprecisions. | |
+4 letters: revascularization. | |
+5 letters: revascularizations. | |
| Source: compiled by the editor from various references; see credits. SCRABBLE® is a registered trademark. All intellectual property rights in and to the game are owned in the U.S.A and Canada by Hasbro Inc., and throughout the rest of the world by J.W. Spear & Sons Limited of Maidenhead, Berkshire, England, a subsidiary of Mattel Inc. Mattel and Spear are not affiliated with Hasbro. | |
Hexadecimal (or equivalents, 770AD-1900s) (references)54 41 49 4C      52 45 43 55 52 53 49 4F 4E |
| Leonardo da Vinci (1452-1519; backwards) (references)
|
Binary Code (1918-1938, probably earlier) (references)01010100 01000001 01001001 01001100 00100000 01010010 01000101 01000011 01010101 01010010 01010011 01001001 01001111 01001110 |
HTML Code (1990) (references)T A I L   R E C U R S I O N |
ISO 10646 (1991-1993) (references)0054 0041 0049 004C      0052 0045 0043 0055 0052 0053 0049 004F 004E |
Encryption (beginner's substitution cypher): (references)543543462523937555253434948 |
| 1. Crosswords 2. Expressions 3. Anagrams 4. Orthography | 5. Bibliography |
Copyright © Philip M. Parker, INSEAD. Terms of Use.