[Armedbear-devel] Tail recursion

Vibhu Mohindra vibhu.mohindra at gmail.com
Thu Nov 20 19:54:28 UTC 2014


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 at common-lisp.net
http://mailman.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel



More information about the armedbear-devel mailing list