3 ms·
In Common Lisp we can use macros to bring about a reasonable tail calling system without relying on TCO support in the implementation. In the Lisp source file
by kazinator 9y ago
In Common Lisp we can use macros to bring about a reasonable tail calling system without relying on TCO support in the implementation.
In the Lisp source file below, I provide a tlet operator whose syntax resembles labels, but which compiled to a tagbody in which the "functions" are just labels.
There is also deftail for tail calling among global functions, which is based on dynamic non-local returns and a dispatch mechanism.
http://www.kylheku.com/cgit/lisp-snippets/tree/tail-recursion.lisp http://www.kylheku.com/cgit/lisp-snippets/tree/tail-recursio...