I just find the answer.
If works.
lets see two exécutions of the same program, the first in perl 5 with tis exec time :
The perl 5 program.
#!/usr/bin/perl
sub ack {
my ($m,$n) = @_;
return ($n+1) if $m == 0;
return ack($m-1, 1) if $n == 0;
print $i++, "\n"; # This is to trace the process.
return ack($m-1, ack($m, $n-1));
}
$r = ack(3,5);
print ("resultat : $r.\n");
Its execution.
resultat : 253.
real 0m0.183s
user 0m0.095s <------
sys 0m0.042s
now in perl6 with multisub
The perl 6 program.
use v6;
multi sub ack (0,$n) {return ($n+1)};
multi sub ack ($m, 0) {return ack($m-1, 1)};
# "say $i++;" is to trace the process.
multi sub ack ($m,$n) {say $i++;return ack($m-1, ack($m, $n-1))};
my $i;
my $r = &ack(3,5);
say ("resultat : $r.");
resultat : 253.
real 1m7.513s
user 1m4.085s <------
sys 0m1.525s
In this case the exec time has been multiplied by 16 !
Wirh the call ack(3,8)
in perl 5, it needs 1391980 calls to obtain the result 2045.
in a user time of 0m6.471s
In perl 6, I did trace it to see that everything was xorking, but, after àne hour I was only at half ot the itération process. It meens that the êrl6 program needs more than 2 hours to reach the result.
Regards.
[footer elided]