On Sun, Feb 09, 2025 at 11:32:38PM -0800, Lindsay Lawrence wrote:
> In trying to compare tco vs recur for my own use I came up with
> the following:
> ...
Nice examples, thanks a lot!
I'd like to point out, however, that recursion and tail call
optimization are not fully equivalent. We always ne
On Mon, Feb 10, 2025 at 02:06:52PM +0100, Alexander Burger wrote:
> : (let N 99 (bench (tco (N) (or (=0 N) (tc (dec N))
> 0.038 sec
> -> 0
For the records - and to show the absurdity of TCO - this is of course
the same as
: (let N 99 (bench (until (=0 N) (dec 'N
0.032 sec
-> 0
☺/
On Sun, Feb 09, 2025 at 02:13:13PM -0800, Lindsay Lawrence wrote:
> It is interesting that I don't see much performance difference between tco
> and recur in most cases.
The difference is better visible if you avoid as much additional
processing as possible, and boil it down to the essential 'recu
On Mon, Feb 10, 2025 at 2:49 AM Alexander Burger
wrote:
> I'd like to point out, however, that recursion and tail call
> optimization are not fully equivalent. We always need to keep that in
> mind!
>
> ...
> So what PicoLisp does is first clean up everything, by first *leaving*
> all enclosing
On Mon, Feb 10, 2025 at 6:32 AM Alexander Burger
wrote:
> On Mon, Feb 10, 2025 at 02:06:52PM +0100, Alexander Burger wrote:
> > : (let N 99 (bench (tco (N) (or (=0 N) (tc (dec N))
> > 0.038 sec
> > -> 0
>
> For the records - and to show the absurdity of TCO - this is of course
> the same
On Mon, Feb 10, 2025 at 2:49 AM Alexander Burger
wrote:
>
> I'd like to point out, however, that recursion and tail call
> optimization are not fully equivalent. We always need to keep that in
> mind!
>
> The original idea of TCO (not the 'tco' function in PicoLisp) is to
> avoid that calling the