I'm learning raku, following the book Thinking in Raku
There is an exercise that I need to define the ackermann function.
I defined a positive Integer subset:
subset Positive-Integer of Int where { $_ > 0}
Then I goes through the recursive version using:
multi ackermann(0, Positive-Integer $n) {
$n + 1;
}
multi ackermann(Positive-Integer $m, 0) {
ackermann $m - 1, 1;
}
multi ackermann(Positive-Integer $m, Positive-Integer $n) {
ackermann $m - 1, ackermann $m, $n - 1;
}
but executing the code I get when executing:
ackermann 3, 4;
> * * &ackermann
> > * * &ackermann
> > * * &ackermann
> > ackermann 3, 4
Cannot resolve caller ackermann(Int:D, Int:D); none of these signatures match:
(0, Int $n)
(Int $m, 0)
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in sub ackermann at <unknown file> line 3
in block <unit> at <unknown file> line 2
>
I do not get the point of what it is happening here.