I think what you're talking about is continuation passing style -
http://en.wikipedia.org/wiki/Continuation-passing_style
I think there was a thread on it a few months back, but from what I
remember its not supported (its dependent on TCO to prevent the stack
from exploding as explained above).
Maybe this is intressting for you:
http://stackoverflow.com/questions/4304468/clojure-jvm-7-8-improvements/4306950#4306950
It should answer your question and give some more information.
On Jan 26, 4:04 pm, Harrison Maseko lis...@gmail.com wrote:
Hi all,
I need some help in understanding some
This discussion is enlightening. Thank you all for your instructive
comments.
-h.
On Jan 27, 1:39 pm, Nick Zbinden nick...@gmail.com wrote:
Maybe this is intressting for
you:http://stackoverflow.com/questions/4304468/clojure-jvm-7-8-improvemen...
It should answer your question and give some
Hi all,
I need some help in understanding some basic concept. The book
Programming Clojure on pages 134 - 136 deals with tail recursion and
self-recursion using recur. The tail recursive example blows the stack
while the self-recursive function using recur presented on page 135
does not. On page
The JVM does not currently support tail call optimization (TCO) so
any tail recursion call is actually calling the function on itself
using the stack to hold new bindings. TCO hides this to you when
it's supported by the language and transforms this into a loop.
Recur will not consume the Java
Tail-recursive just means the recursive call occurs in tail position: the
result of the recursive call gets returned as-is rather than having some
additional computations done to it first. This means the compiler *could*
optimize the recursive call to not consume any additional stack space, by
On Wed, Jan 26, 2011 at 7:41 AM, Michael Gardner gardne...@gmail.com wrote:
However, the JVM does not support tail-call optimization. Apparently Clojure
can't support implicit TCO without support from the JVM
always wondered about that also wrt scala etc., am under the
impression that it is
From what I recall from a previous thread it would require so much byte code
tweaking that
Hot Spot optimizations would become useless.
You can search the mailing list, you will find a couple of instructive
discussions
about this.
Luc P.
On Wed, 26 Jan 2011 10:01:04 -0800
Raoul Duke
From SICP: With a tail-recursive implementation, iteration can be
expressed using the ordinary procedure call mechanism. As I
understand this, a tail call is a loop with functional notation but
not actually a function call. That's why I find this issue difficult
to follow, since loops are internal
I found Rich's answer August 14th, 2008:
On Aug 14, 6:35 am, rob.la...@gmail.com rob.la...@gmail.com wrote:
As I understand it, Clojure does not have tail call optimisation,
because of limitations of the JVM. Scala, however, has TCO, or at
least something called Tail Recursion Optimisation
Now try writing two mutually-recursive functions. In Scheme (as I
understand it) that will get optimized into a jump from one function
to the other, while in Clojure it will use the stack.
On Jan 26, 1:10 pm, Armando Blancas armando_blan...@yahoo.com wrote:
From SICP: With a tail-recursive
2011/1/26 Alan a...@malloys.org:
Now try writing two mutually-recursive functions. In Scheme (as I
understand it) that will get optimized into a jump from one function
to the other, while in Clojure it will use the stack.
And that's why Rich introduced clojure.core/trampoline.
Cheers,
--
These last posts cleared it up. Thanks.
Which remind me, I think one of the SICP lectures on youtube mentions
tail calls to *other* functions, which I totally forgot, with an
example of a person doing something for another doing something for
another... and the last one just gives the result to
13 matches
Mail list logo