DenkzeitWiki

Suchen:

Aktuelle Änderungen Printable View Änderungen Bearbeiten

StatementsAndExpressions > StaticVsDynamicTypingArguments > StevenLevy > StoredProcedures > StructuredQueryLanguage > SymbolicProgramming > SyntacticAbstraction > SystemBackup > SystemBackups > SystemBackup > TFS > TeamFoundationServer > TShirts > TailCallElimination > Recursion > TailCallOptimization > RecursionClear Trail
Main /

Recursion

(weitergeleitet von Main.TailCallOptimization)


Tail Recursion


Tail recursion is interesting because it is form of recursion that can be implemented much more efficiently than general recursion. In general, a recursive call requires the compiler to allocate storage on the stack at run-time for every call that has not yet returned. This memory consumption makes recursion unacceptably inefficient for representing repetitive algorithms having large or unbounded size. Tail recursion is the special case of recursion that is semantically equivalent to the iteration constructs normally used to represent repetition in programs. Because tail recursion is equivalent to iteration, tail-recursive programs can be compiled as efficiently as iterative programs. [1]


A compiler is said to implement TailRecursion if it recognizes this case and replaces the caller in place with the callee, so that instead of nesting the stack deeper, the current stack frame is reused.[2]


Tail Call Optimization

HeapAndStack






Object-oriented programming in languages that don't require tail-call optimizations makes no sense. MatthiasFelleisen




Edit - BackLinks - Tags - Page Hist - Print - Changes - Home - Orphans - Help

Zuletzt geändert am 20.12.2009 14:23 Uhr und seit 7. April 2005 3154 aufgerufen.