Data update

This commit is contained in:
Ingy döt Net 2024-03-06 22:25:12 -08:00
parent ed705008a8
commit 0df55f9f24
2196 changed files with 32999 additions and 3075 deletions

View file

@ -0,0 +1,15 @@
:import std/Combinator .
:import std/Number/Unary U
:import std/Math .
# unary ackermann
ackermann-unary [0 [[U.inc 0 1 (+1u)]] U.inc]
:test (ackermann-unary (+0u) (+0u)) ((+1u))
:test (ackermann-unary (+3u) (+4u)) ((+125u))
# ternary ackermann (lower space complexity)
ackermann-ternary y [[[=?1 ++0 (=?0 (2 --1 (+1)) (2 --1 (2 1 --0)))]]]
:test ((ackermann-ternary (+0) (+0)) =? (+1)) ([[1]])
:test ((ackermann-ternary (+3) (+4)) =? (+125)) ([[1]])

View file

@ -18,9 +18,9 @@ ackermann(m,n)
public program()
{
for(int i:=0, i <= 3, i += 1)
for(int i:=0; i <= 3; i += 1)
{
for(int j := 0, j <= 5, j += 1)
for(int j := 0; j <= 5; j += 1)
{
console.printLine("A(",i,",",j,")=",ackermann(i,j))
}

View file

@ -0,0 +1,9 @@
$ENTRY Go {
= <Prout 'A(3,9) = ' <A 3 9>>;
};
A {
0 s.N = <+ s.N 1>;
s.M 0 = <A <- s.M 1> 1>;
s.M s.N = <A <- s.M 1> <A s.M <- s.N 1>>>;
};