On Sat, Feb 08, 2025 at 07:23:45PM -0800, Lindsay Lawrence wrote:
> I gave 'tco' a try.  I appreciate the syntax. The similarity with existing
> recur syntax
> makes it trivial to convert code where tail calls are possible.

You can also have use cases for both at the same time.

For example, a tree can be iterated by recursing on the left branches
and then looping on the right branches:

: (use Idx
   (balance 'Idx (range 1 7))
   (recur (Idx)
      (tco (Idx)
         (when Idx
            (printsp (car Idx))
            (recurse (cadr Idx))
            (tc (cddr Idx)) ) ) ) )
4 2 1 3 6 5 7 -> NIL

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to