summaryrefslogtreecommitdiff
path: root/miralib/ex/ack.m
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-04 12:32:20 -0500
committerJakob Kaivo <jkk@ung.org>2022-03-04 12:32:20 -0500
commit55f277e77428d7423ae906a8e1f1324d35b07a7d (patch)
tree5c1c04703dff89c46b349025d2d3ec88ea9b3819 /miralib/ex/ack.m
import Miranda 2.066 from upstream
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"