Anonymous user
Ackermann function: Difference between revisions
no edit summary
m (made m4 the first m) |
No edit summary |
||
Line 378:
Prelude> ack 3 4
125</pre>
=={{header|haXe}}==
<lang haXe>
class RosettaDemo
{
static public function main()
{
neko.Lib.print(ackermann(3, 4));
}
static function ackermann(m : Int, n : Int)
{
if (m == 0)
{
return n + 1;
}
else if (n == 0)
{
return ackermann(m-1, 1);
}
return ackermann(m-1, ackermann(m, n-1));
}
}
</lang>
=={{header|J}}==
|