summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-05-15 14:52:33 -0400
committernodist <kevin.comas.git@gmail.com>2026-05-15 14:52:33 -0400
commitda478d8063e2f649c8d7b4bc6579e8afbd8b9ab0 (patch)
treee35256e6c0841a49ff339291db84aff0f7d70b6c
parent56be34c67a712a5f9a2308bc71ad6a3d13c2e6ad (diff)
basic fib example
-rw-r--r--fib.kpl10
1 files changed, 10 insertions, 0 deletions
diff --git a/fib.kpl b/fib.kpl
new file mode 100644
index 0000000..a907739
--- /dev/null
+++ b/fib.kpl
@@ -0,0 +1,10 @@
+
+// Fibonacci sequence for all numeric types
+
+fib : Fn[n] $ (
+ ? {
+ n <= 0 { 0 }
+ n < 3 { 2 }
+ { `sync(fib; n - 1) + fib `sync n - 2 }
+ }
+)