Hi Vibhu,

Thanks for sharing your thoughts. Indeed, rewriting function bodies in the case of tail recursion is an option. However, do we know which percentage of TCO calls can be optimized by using deftro? So far, I have not spent any energy on TCO because my idea is that the benefit is just too small -- in other words, I expect that the number of cases that would benefit from TCO without getting optimization is just too big...

Do you have any idea/ numbers?


Regards,


Erik.


On Thu, Nov 20, 2014 at 8:54 PM, Vibhu Mohindra <vibhu.mohindra@gmail.com> wrote:
One idea I have is to use deftro (described below) instead of defun
for tail recursive functions. On TCO Lisps define deftro to just
be defun. On others define it to rewrite the body. It won't optimise
all tail calls, just those are self-recursive.

http://www.wispym.com/notes/tech/lisp/tco.txt

I haven't used this myself. But I might start, because it's not
ugly in the following sense. Writing a tail recursive function and
depending implicitly on TCO is non-portable. deftro is a portability
layer.


_______________________________________________
Armedbear-devel mailing list
Armedbear-devel@common-lisp.net
http://mailman.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel



--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.