summaryrefslogtreecommitdiff
path: root/benchmark/other-lang/tak.pl
blob: 7e748a67c6e9ee9a242b086cda6edb42111529e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
sub tak {
    local($x, $y, $z) = @_;
    if (!($y < $x)) {
	return $z;
    } else {
	return &tak(&tak($x - 1, $y, $z),
		    &tak($y - 1, $z, $x),
		    &tak($z - 1, $x, $y));
    }
}
&tak(18, 9, 0);