summaryrefslogtreecommitdiff
path: root/jni/ruby/benchmark/other-lang/ack.pl
blob: 201e22ddfabc7706558fa1ad485467fc414b39d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
use integer;

sub Ack {
    return $_[0] ? ($_[1] ? Ack($_[0]-1, Ack($_[0], $_[1]-1))
                    : Ack($_[0]-1, 1))
        : $_[1]+1;
}

my $NUM = 9;
$NUM = 1 if ($NUM < 1);
my $ack = Ack(3, $NUM);