Where results make sense
 About us   |   Why use us?   |   Reviews   |   PR   |   Contact us

# Topic: Tail recursion

 Tail recursion - Wikipedia, the free encyclopedia Since having a complete call graph is a daunting task for compilers, a mere tail call is usually referred to as being tail recursive. Tail recursion modulo cons is a generalization of tail recursion introduced by David H. Warren. Tail recursion is important to some high-level languages, especially functional languages and members of the Lisp family. en.wikipedia.org /wiki/Tail_recursion   (1305 words)

 Recursion - Wikipedia, the free encyclopedia So a recursive meal might be potato skins, baby greens salad, chicken parmesan, and for dessert, a four course meal, consisting of crab cakes, Caesar salad, for an entrĂ©e, a four course meal, and chocolate cake for dessert, so on until each of the meals within the meals is completed. This one is also the second-shortest possible example of an erroneous recursive definition of an object, the error being the absence of the termination condition (or lack of the initial state, if to look at it from an opposite point of view). The function calls itself recursively on a smaller version of the input (n - 1) and multiplies the result of the recursive call by n, until reaching the base case, analogously to the mathematical definition of factorial. en.wikipedia.org /wiki/Recursion   (1591 words)

 Recursion Recursion is a technique that allows us to break down a problem into one or more subproblems that are similar in form to the original problem. A recursive function is said to be tail recursive if there are no pending operations to be performed on return from a recursive call. Tail recursive functions are often said to "return the value of the last recursive call as the value of the function." Tail recursion is very desirable because the amount of information which must be stored during the computation is independent of the number of recursive calls. triton.towson.edu /~akayabas/COSC455_Spring2000/Recursion_Iteration.htm   (894 words)

 Tail recursion: Facts and details from Encyclopedia Topic   (Site not responding. Last check: 2007-11-07) In mathematics and computer science, recursion is a particular way of specifying (or constructing) a class of objects (or an object from a certain class) with... Note that the tail call doesn't have to literally appear after all other statements in the source code; it is only important that its result is immediately returned, EHandler: no quick summary. (full tail recursion may require a function that was previously purely functional to be written such that it mutates references stored in other variables. www.absoluteastronomy.com /encyclopedia/t/ta/tail_recursion.htm   (1977 words)

 VisualWorks: Tail Recursion   (Site not responding. Last check: 2007-11-07) The problem is, "tail recursion" is a misnomer, while a common misconception is to take it literally. Tail calls is an important part of the semantics of Scheme because they are required by the language standard. The two common misconceptions seem to be: 1) "tail recursion" is about recursive functions/methods (very unintuitively, it is not); and 2) since in Smalltalk the receiver of a message is usually not known at the compilation time, tail recursion is impossible/difficult to implement and the implementation would require runtime checks. wiki.cs.uiuc.edu /VisualWorks/Tail+Recursion   (1535 words)

 CS 2360 - April 14, 1998 So, it may look like iteration, but tail recursion is most definitely a clever and successful attempt to reap some of the resource savings of iterative solutions while maintaining design qualities of the functional programming paradigm. It may be true that the concept of recursion itself is difficult to grasp, but for most folks it seems that the real problem is that they've been trained to think about repetitive computations in a certain way, using index variables and loops and so on. Recursion examples After exploring the factorial function in great detail, we went over a bunch of examples, comparing augmenting recursion examples to tail recursion examples. www.cc.gatech.edu /computing/classes/cs2360/spring98/lec05.html   (1845 words)

 Tail (disambiguation) - Wikipedia, the free encyclopedia Tail describes the rear of an animal's body, especially as a flexible appendage. Tail (Unix), a Unix program used to display the last few lines of a file Tail rotor, a small vertical propeller mounted at the rear of a helicopter en.wikipedia.org /wiki/Tails   (172 words)

 Squawks of the Parrot: What the heck is: A tail call   (Site not responding. Last check: 2007-11-07) Tail calls, and their more restricted brethren tail recursion, are one of those clever optimizer tricks that were invented many years ago, then promptly forgotten by most of the mainstream language implementors. Tail because it has to happen as the very last operation in a function, or as the function's tail operation. Tail recursion is easier to deal with because rather than having to jump to the beginning of some random function somewhere, you just do a www.sidhe.org /~dan/blog/archives/000211.html   (1302 words)

 Tail Recursion   (Site not responding. Last check: 2007-11-07) In this example, the recursive call to `myfun' is tail-recursive: (defun myfun (x) (if (oddp (random x)) (isqrt x) (myfun (1- x)))) Tail recursion is interesting because it is form of recursion that can be implemented much more efficiently than general recursion. Tail recursion is the special case of recursion that is semantically equivalent to the iteration constructs normally used to represent repetition in programs. It helps to understand how to use tail recursion if you think of a tail-recursive call as a `psetq' that assigns the argument values to the called function's variables, followed by a `go' to the start of the called function. cis.ksu.edu /VirtualHelp/Info/develop/cmu-user.info.Tail_Recursion.html   (594 words)

 Lab 9 Tail recursion and loops   (Site not responding. Last check: 2007-11-07) For a tail call, Scheme doesn't have to remember anything, because there is nothing more to do: after it is done with the current function call, it is really done. Tail calls also permit us to forget the values of function parameters and local variables, because we never do any more work in the calling function, but a non-tail call forces us to remember such values, which might be used when we return to the calling function. In particular, if a function makes a recursive call, but then examines the result and does different things depending on its value, then it may not be possible to make the function tail-recursive. www.owlnet.rice.edu /~comp210/96spring/Labs/lab09.html   (1534 words)

 LtU Classic Archives Tail call elimination and and the difference between tail calls and tail recursion are frequent topics on language related discussion groups. Instead, the entire phrase "proper tail recursion" refers to a property that is achieved by implementing (syntactic) tail calls in any of several systematic ways, and is not achieved by several other systematic ways or by any unsystematic approach. That they themselves often overloaded "proper tail recursion" to mean both a certain approach to implementing them and the space efficiency property helped cause the confusion between tail call optimization and the space efficiency property. lambda-the-ultimate.org /classic/message1532.html   (1474 words)

 Mastering recursive programming   (Site not responding. Last check: 2007-11-07) Recursion is a tool not often used by imperative language developers, because it is thought to be slow and to waste space, but as the author demonstrates, there are several techniques that can be used to minimize or eliminate these problems. With recursive programs that recurse instead of change state, the number of occasions of state change is small and the program variables maintain self-consistency by setting all of the recursion variables at once. Recursion is a great art, enabling programs for which it is easy to verify correctness without sacrificing performance, but it requires the programmer to look at programming in a new light. www-128.ibm.com /developerworks/linux/library/l-recurs.html   (5938 words)

 Recursion samples   (Site not responding. Last check: 2007-11-07) A recursive function is said to be tail recursive if there are no pending operations to be performed on return from a recursive call, or in other words: A tail recursive function returns the value of the last recursive call as the value of the function. Its tail recursion counterpart is much more efficient as you can also see if you run both samples: The tree recursion algorithm takes a quite sensible amount of time to compute Fibonacci(25). tail recursion the result of the recursive call is returned to the caller without further processing. lavape.sourceforge.net /doc/html/RecursionSamples.htm   (361 words)

 Revised(5) Report on the Algorithmic Language Scheme - Tail recursion   (Site not responding. Last check: 2007-11-07) Intuitively, no space is needed for an active tail call because the continuation that is used in the tail call has the same semantics as the continuation passed to the procedure containing the call. A tail call is a procedure call that occurs in a tail context. The reference to x is in a tail context, but it is not a call and thus is not a tail call. www.cs.rice.edu /CS/PLT/packages/doc/r5rs/node22.htm   (645 words)

 Joe Marshall on Rebol 1.0 Proper tail recursion is usually easy to achieve in most languages, but in REBOL it surprisingly difficult. When evaluating a sequence of expressions in a block, we recursively evaluate the first expression in the sequence obtaining its value and the `remaining' part of the block. Tail recursion comes down to this: when recursively invoking the interpreter, do not create `trivial' continuations. ll1.ai.mit.edu /marshall.html   (1938 words)

 [No title] With the recursion we were first doing, this was not the case; after the new problem was solved, there was that last multiplication going on. If we have a recursive procedure and all of the recursive calls are reductions, then we call it "tail recursion". This is fairly common, and occurs with augmenting recursion as well as tail recursion. www.cc.gatech.edu /classes/cs2360/spring97/lectures/lecture5.txt   (2407 words)

 [No title] Tail calls are special cases of function calls that, when optimized, can survive on little more memory than is required to keep the record of the current running function. Recursion involves writing functions that make a call to themselves (presumably with different arguments) sometime in the course of their execution. Tail recursion can be an effective coding style when the compiler is known to optimize tail calls. cda.mrs.umn.edu /~hans1482/cscisem2.doc   (3094 words)

 "The Anatomy of a Loop" | Lambda the Ultimate For the recursion vs. iteration debate, I would be most happy to write an "Exclusion of mechanisms considered harmful" paper that lays out the point that in some cases, recursion make sense, and in others, iteration makes sense. Tail calls may be similar to goto from an implementation standpoint, but they're no different from a function call in terms of the language itself. It has the form: Recursive forms (of iterative functions) are pretty, but practically they need to be written in tail-recursive form, but tail-recursive form looks mostly like the imperative iterative form and is much uglier than the recursive form; therefore we should always use an ugly imperative iteration. lambda-the-ultimate.org /node/view/1014   (8078 words)

 Tail Recursion   (Site not responding. Last check: 2007-11-07) Below is the code fragment after tail recursion. Tail recursion can significantly improve the performance of small recursive benchmarks such as Hanoi. Although more difficult than simple tail recursion, it is also possible to optimize a() calls b() calls a() tail recursion. www.nullstone.com /htmls/category/tailrec.htm   (126 words)

 Laboratory Exercises For Computer Science 153 recursively twice in the case that the largest value occurs later in the list. A tail recursive approach to this problem uses parameters to keep a running sum and a running count of the number of items processed. Write a tail recursive solution to this problem, using a separate kernel procedure. www.math.grin.edu /~walker/courses/153.sp01/lab-tail-recursion.html   (796 words)

 An Introduction to Scheme and its Implementation - Tail Recursion   (Site not responding. Last check: 2007-11-07) Technically, loop-like recursion is called tail recursion, which we'll explain in detail in a later chapter. Tail-calling allows recursion to be used for looping, because a tail call that acts to iterates a loop doesn't save the caller's state on a stack. Some compilers for languages such as Common Lisp and C perform a limited form of "tail call optimization," but Scheme's treatment of tail calls, is more general, and standardized, so you can use recursion more freely in your programs, without fear of stack overflow if you code your routines tail-recursively. www.cs.utexas.edu /ftp/pub/garbage/cs345/schintro-v14/schintro_73.html   (355 words)

 Diagnosing Java Code: Improve the performance of your Java code   (Site not responding. Last check: 2007-11-07) A quick reminder: a recursive call is tail recursive if the return value of that call is immediately returned as the value of the calling function; it isn't necessary to remember the context of the calling function when invoking the call. But because the variable parameter values are sent to the recursive call all at once, it is much easier to get the updated values right than it is in a loop. Although the manual is, of course, written for Common Lisp, the discussion on tail recursion is applicable to other languages, including the Java language. www-128.ibm.com /developerworks/java/library/j-diag8.html   (1391 words)

 [No title] [3/1/99] =============================================================================== * Tail recursion - a quick reminder: Tail recursion is a way of writing a loop without using a loop - instead, recursive syntax is used. The running time of a function _is not_ affected by the fact that it is tail recursive or not - this is just a matter of space needed for its running. l) (reverse a) (iter (tail l) (cons (f (head l)) a)))) (iter l empty)) -------------------- The result _is_ tail recursive, but it didn't help much - not in run-time and not in memory. www.cs.cornell.edu /courses/cs212/1999sp/sections/sec-10.txt   (622 words)

 [Python-Dev] Proper tail recursion   (Site not responding. Last check: 2007-11-07) The recursion limit (the value of it anyhow) is an implementation detail. I wouldn't say that tail recursion *encouraged* a functional style, rather I would say that refusing to accept a working version of tail recursion actively *discourages* the use of that style. Rejecting an implementation of tail recursion because it doesn't work well or it slows down other cases is perfectly reasonable. mail.python.org /pipermail/python-dev/2004-July/046201.html   (385 words)

 5.5 Tail Recursion   (Site not responding. Last check: 2007-11-07) Tail recursion is interesting because it is form of recursion that can be implemented much more efficiently than general recursion. So tail recursion doesn't necessarily have anything to do with recursion as it is normally thought of. See section 5.6.4 for more discussion of using tail recursion to implement loops. www.umiacs.umd.edu /~bonnie/courses/programming/cmu_manual/node140.html   (536 words)

 Brain.Save() - Tail recursion!   (Site not responding. Last check: 2007-11-07) This code is said to be tail-recursive, because the last expression inside the procedure is a recursive call to itself. However, there’s really no semantic reason why this has to be accomplished recursively – you could do some magic behind the scenes to turn tail recursion into iteration. I think I could implement tail recursion a little bit more cleanly, but it does work as I have it now. hyperthink.net /blog/PermaLink,guid,ddd56380-9418-404b-8429-7f1656127b2e.aspx   (439 words)

 tail recursion | Lambda the Ultimate However, suppose after a long chain of recursive tail calls, the attempt to allocate a new AR fails due to insufficient memory. Scheme requires tail calls to be optimized even if they are between different functions, potentially with no recursion involved. Scheme is one of the first that requires tail call optimization as part of the langauge spec though. lambda-the-ultimate.org /node/view/717   (1824 words)

Try your search on: Qwika (all wikis)

About us   |   Why use us?   |   Reviews   |   Press   |   Contact us