On Dec 20, 2:46 pm, Randall R Schulz <rsch...@sonic.net> wrote:
> On Saturday 20 December 2008 06:29, verec wrote:
>
> > I'm just curious about examples where such a "magic transformation"
> > would result in violated assumptions.
>
> Write some Clojure code and use recur freely, without regard to whether
> it's in tail position and the compiler will tell you when it's not.

I have more experience with CL (that does not guarantee TCO) than
with Scheme, so I didn't know that Scheme was warning you when
you made a plain (non tail) recursive call... Or does it?

> The problem is that if local bindings are needed after the recursive
> call returns

That is the definition of a non tail call! My point is that I'm
interested
to see an actual example of a proper tail call situation where
currently
recur does work but where the "normal" function call wouldn't.

I still fail to see what guarantees Rich is talking about. But I'm
sure
that someone will illuminate my quest by providing an actual example
where

(defn foo [x]
   (if (zero? x) 0
      (foo (dec x))))

would violate assumptions that

(defn foo [x]
  (if (zero? z) 0
    (recur (dec x))))

would not.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to