September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,30 +1,30 @@
|
|||
import extensions.
|
||||
import extensions;
|
||||
|
||||
ackermann(m,n)
|
||||
[
|
||||
if((n < 0)||(m < 0))
|
||||
[
|
||||
InvalidArgumentException new; raise
|
||||
].
|
||||
{
|
||||
if(n < 0 || m < 0)
|
||||
{
|
||||
InvalidArgumentException.raise()
|
||||
};
|
||||
|
||||
m =>
|
||||
0 [ ^n + 1 ];
|
||||
! [
|
||||
0 { ^n + 1 }
|
||||
: {
|
||||
n =>
|
||||
0 [ ^ackermann(m - 1,1) ];
|
||||
! [ ^ackermann(m - 1,ackermann(m,n-1)) ]
|
||||
]
|
||||
]
|
||||
0 { ^ackermann(m - 1,1) }
|
||||
: { ^ackermann(m - 1,ackermann(m,n-1)) }
|
||||
}
|
||||
}
|
||||
|
||||
public program
|
||||
[
|
||||
0 to:3 do(:i)
|
||||
[
|
||||
0 to:5 do(:j)
|
||||
[
|
||||
console printLine("A(",i,",",j,")=",ackermann(i,j))
|
||||
]
|
||||
].
|
||||
public program()
|
||||
{
|
||||
for(int i:=0, i <= 3, i += 1)
|
||||
{
|
||||
for(int j := 0, j <= 5, j += 1)
|
||||
{
|
||||
console.printLine("A(",i,",",j,")=",ackermann(i,j))
|
||||
}
|
||||
};
|
||||
|
||||
console readChar
|
||||
]
|
||||
console.readChar()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue