On 15 June 2010 22:56, Quzanti <quza...@googlemail.com> wrote:
> Thanks Mike.
>
> So does is the only kind of recursion optimisation tail recursion?
>
> Can you only eliminate stack calls in tail calls?

No, you can also eliminate stack calls using lazy-seq or trampolines.

If you provide some example code of what you are currently doing, it
would be easier to gauge what is the most suitable approach.

You might not even need to bother eliminating stack calls, if you know
you're never going to recurse very far.

> Having some sort of hint about this in the recur documentation might
> be helpful?

Well, the docs do say "recur in other than a tail position is an
error", though that does assume the reader knows what the tail
position of a function is.

- James

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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