Content deleted Content added
Revert even further to get rid of more vandalism |
Oops, that was too far. This is better. |
||
Line 1:
In [[computer science]], '''tail recursion''' (or '''tail-end recursion''') is a special case of [[Recursion_(computer_science)|recursion]] in which the last operation of the function, the [[tail call]], is a recursive call. Such recursions can be easily transformed to iterations. Replacing recursion with [[iteration]], manually or automatically, can drastically decrease the amount of [[Call stack|stack]] space used and improve efficiency. This technique of iterative calculation is commonly used with [[functional programming]] languages, where the [[declarative programming|declarative approach]] and explicit handling of [[state (computer science)|state]] promote the use of recursive functions that would otherwise rapidly fill the [[call stack]].
==Description==
Line 33:
;; to calculate the product of all non-negative integers
;; less than or equal to n.
(define (factorial n)
(
(
(fact (- i 1) (* acc i)))))
</source>
|