Roger Browne:
> Unfortunately I could only get to Ack(3, 6) before parrot aborted with
> "maximum recursion depth exceeded", at recursion depth 1000.
Alternative:
#!/usr/bin/perl
use strict;
use warnings;
use Memoize;
{ local ($,, $\) = ("\t", "\n");
sub ack {
return $_[1] +1 if 0 == $_[0];
return ack($_[0] -1, 1) if 0 == $_[1];
return ack($_[0] -1, ack($_[0], $_[1] -1));
}
memoize('ack');
my $base = 3;
print "Ack($base, $_): ", ack($base, $_) for (0..13);
}
--
Affijn, Ruud
"Gewoon is een tijger."