Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,20 @@
using System;
using Nemerle.IO;
def ackermann(m, n) {
def A = ackermann;
match(m, n) {
| (0, n) => n + 1
| (m, 0) when m > 0 => A(m - 1, 1)
| (m, n) when m > 0 && n > 0 => A(m - 1, A(m, n - 1))
| _ => throw Exception("invalid inputs");
}
}
for(mutable m = 0; m < 4; m++) {
for(mutable n = 0; n < 5; n++) {
print("ackermann($m, $n) = $(ackermann(m, n))\n");
}
}

View file

@ -0,0 +1,6 @@
def ackermann(m, n) {
| (0, n) => n + 1
| (m, 0) when m > 0 => ackermann(m - 1, 1)
| (m, n) when m > 0 && n > 0 => ackermann(m - 1, ackermann(m, n - 1))
| _ => throw Exception("invalid inputs");
}

View file

@ -0,0 +1,9 @@
def ackermann = {
def A(m, n) {
| (0, n) => n + 1
| (m, 0) when m > 0 => A(m - 1, 1)
| (m, n) when m > 0 && n > 0 => A(m - 1, A(m, n - 1))
| _ => throw Exception("invalid inputs");
}
A
}