in reply to Ackerman vs. Perl : KO in 3 rounds
I think a better implementation of the function (at least it runs properly for me) is:
Note that this really does save stack space. Although, considering what Ackermann's function does, this is (I suspect) a losing battle. :-)sub A { BARE_BLOCK: { if (0 == $_[0]) { return 1 + $_[1]; } @_=($_[0] - 1, $_[1] ? A($_[0], $_[1]-1) : 1); redo BARE_BLOCK; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re (tilly) 1: Ackerman vs. Perl : KO in 3 rounds
by John M. Dlugosz (Monsignor) on Dec 18, 2001 at 03:34 UTC | |
by tilly (Archbishop) on Dec 18, 2001 at 04:29 UTC | |
by John M. Dlugosz (Monsignor) on Dec 19, 2001 at 22:10 UTC | |
by tilly (Archbishop) on Dec 19, 2001 at 23:07 UTC | |
by tilly (Archbishop) on Dec 18, 2001 at 03:42 UTC | |
by John M. Dlugosz (Monsignor) on Dec 19, 2001 at 22:01 UTC | |
by tilly (Archbishop) on Dec 20, 2001 at 02:18 UTC |