new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
19
Task/Ackermann-function/Sather/ackermann-function-2.sa
Normal file
19
Task/Ackermann-function/Sather/ackermann-function-2.sa
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class MAIN is
|
||||
|
||||
ackermann(m, n:INTI):INTI is
|
||||
zero ::= 0.inti; -- to avoid type conversion each time
|
||||
one ::= 1.inti;
|
||||
if m = zero then return n + one; end;
|
||||
if n = zero then return ackermann(m-one, one); end;
|
||||
return ackermann(m-one, ackermann(m, n-one));
|
||||
end;
|
||||
|
||||
main is
|
||||
n, m :INT;
|
||||
loop n := 0.upto!(6);
|
||||
loop m := 0.upto!(3);
|
||||
#OUT + "A(" + m + ", " + n + ") = " + ackermann(m.inti, n.inti) + "\n";
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue