thanks Meikel for your clarification.. I used to think loop recur almost removed the need for TCO .. but here is a case where true TCO could be really helpfull.. Sunil.
On Sun, Dec 19, 2010 at 1:33 PM, Meikel Brandmeyer <m...@kotka.de> wrote: > Hi, > > Am 19.12.2010 um 08:30 schrieb Sunil S Nandihalli: > > > Hello everybody, > > It would be nice if calling recur inside a defmethod redispatched on the > new arguments.. I have shown a simple use-case in the following gist. > > https://gist.github.com/747171 > > > > It might be naive .. but I feel IMHO that this should be the default > behaviour and not have any performance issues related to it.. > > recur is a simple goto to the enclosing loop or method. It cannot cross the > enclosing method borders. So it also can't redispatch. You'd need recur to > know, that it is in a mutlimethod and that there is no enclosing loop and > then it to behave differently in that case. The method itself is just a > plain clojure function. > > If you need to re-dispatch you have to use true recursion and call the > multimethod again by name. > > Sincerely > Meikel > > -- > 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<clojure%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- 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