summaryrefslogtreecommitdiff
path: root/miralib/ex/ack.m
diff options
context:
space:
mode:
Diffstat (limited to 'miralib/ex/ack.m')
-rw-r--r--miralib/ex/ack.m9
1 files changed, 9 insertions, 0 deletions
diff --git a/miralib/ex/ack.m b/miralib/ex/ack.m
new file mode 100644
index 0000000..8a743eb
--- /dev/null
+++ b/miralib/ex/ack.m
@@ -0,0 +1,9 @@
+||defines ackermann's function, beloved of recursion theorists. Example
+|| ack 3 3
+||should yield 61, after doing a huge amount of recursion. Can only be
+||called for small arguments, because the values get so big.
+
+ack 0 n = n+1
+ack (m+1) 0 = ack m 1
+ack (m+1) (n+1) = ack m (ack (m+1) n)
+ack m n = error "ack applied to -ve or fractional arg"