News for hackers. Stuff that matters.
Re:ChrysaLisp by kazinator on Tuesday January 14, 2020 @02:44PM (#22048476)
Tail recursion can be cobbed together with macros. This is particularly effective for recursion among local functions in the same lexical scope:

http://www.kylheku.com/cgit/lisp-snippets/tree/tail-recursio...

The above tail recursion macros achieve local tail calls by transforming to a tagbody with go. This is offered in the form of a tlet macro whose syntax is like labels. Write your mutually tail recursive functions as labels, then change labels to tlet to try it with this.

tlet is based on argtags: a form of tagbody whose labels take arguments. These arguments perform a re-assignment of local variables from parameters that accompany the goto transfer.

Tail calls among top-level functions are supposed by a complementary facility called deftail which uses a combination of non-local dynamic control transfers and a dispatch trampoline.

There are no comments on this comment yet.