RosettaCodeData/Task/Ackermann-function/Perl-6/ackermann-function-2.pl6

4 lines
171 B
Raku

multi sub A(0, Int $n) { $n + 1 }
multi sub A(Int $m, 0 ) { A($m - 1, 1) }
multi sub A(Int $m, Int $n) { A($m - 1, A($m, $n - 1)) }