aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark/other-lang/tak.pl
blob: c7bb626e61e75c8e8ecabcf36407e8331f7a6f04 (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);