aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-10-22 15:27:35 -0400
committernodist <kevin.comas.git@gmail.com>2026-10-22 15:27:35 -0400
commit26dfb9719d8101cb12611209ac1004e66902aa86 (patch)
tree343b5878c7b1a589cf40d5b7afd6f1bbb02dd5dd
parent62ac54d9303d6cdec80c67cef093e034031e25c4 (diff)
add ackerman example
-rw-r--r--ack.kpl14
1 files changed, 14 insertions, 0 deletions
diff --git a/ack.kpl b/ack.kpl
new file mode 100644
index 0000000..29d4716
--- /dev/null
+++ b/ack.kpl
@@ -0,0 +1,14 @@
+
+// Ackerman Function Example
+
+`export ack : `{[I64 m; I64 n]
+ ? |(m < 0; n < 0) { `return.error $ "m And n Cannot Be Negative" }
+ ack_native : `{[I64 m; I64 n]
+ ? {
+ m = 0 { n + 1 }
+ &(m > 0; n = 0) { ack_native `call (m - 1; 1) }
+ { ack_native `call (m - 1; ack_native `call (m; n - 1)) }
+ }
+ }
+ ack_native `call (m; n)
+}