A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
20
Task/Ackermann-function/Haxe/ackermann-function.haxe
Normal file
20
Task/Ackermann-function/Haxe/ackermann-function.haxe
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class RosettaDemo
|
||||
{
|
||||
static public function main()
|
||||
{
|
||||
Sys.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));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue