On Thursday 02 April 2009 19:05:48 Chas Emerick wrote:
> On Apr 2, 2009, at 1:14 PM, Jim Menard wrote:
> > On Thu, Apr 2, 2009 at 1:10 PM, Bradford Cross
> >
> > <[email protected]> wrote:
> >> What is the current state of the art for language implementers
> >> working
> >> around these issues (tail calls, continuations, etc) in Clojure,
> >> Scala,
> >> JRuby, etc?
> >
> > Clojure uses recur (http://clojure.org/special_forms#toc10), "the only
> > non-stack-consuming looping construct in Clojure".
>
> In practice, recur in clojure is all you ever need to write non-stack-
> consuming functions that have excellent performance characteristics
> (each recursion is simply a trip through a while loop, IIRC).
Here is a trivial counter example written in OCaml:
let even odd n =
printf "even %d\n" n;
odd(n+1)
let rec odd n =
even odd (n+1)
let () = odd 1
The branch target "odd" in the "even" function is not statically known. So
that program cannot be written correctly in Scala or Clojure.
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---