aboutsummaryrefslogtreecommitdiff
path: root/fib.kpl
diff options
context:
space:
mode:
authornodist <kevin.comas.git@gmail.com>2026-08-08 08:45:17 -0400
committernodist <kevin.comas.git@gmail.com>2026-08-08 08:45:17 -0400
commitb5111570d2de58741d2d932cb149dfe5aea39d1b (patch)
treeaececbc71669dee6546e80164501b22a3a14ed0b /fib.kpl
parent651cec72681afc0821a03a71d07aaa797d37649e (diff)
reset
Diffstat (limited to 'fib.kpl')
-rw-r--r--fib.kpl39
1 files changed, 0 insertions, 39 deletions
diff --git a/fib.kpl b/fib.kpl
deleted file mode 100644
index d8a2140..0000000
--- a/fib.kpl
+++ /dev/null
@@ -1,39 +0,0 @@
-
-// Fibonacci sequence
-
-`export fib_recursive : {[I64.n]
- ? {
- n < 0 { %.error ~ "#BOLD#RED#Invalid n Got %#" `format n }
- n = 0 { 0 }
- n < 2 { 1 }
- { + (fib `sync n - 1; fib `sync n - 2) }
- }
-}
-
-`export fib_iterative : {[I64.n]
- ? n < 0 {
- `return.error ~ "#BOLD#RED#Invalid n Got %#" `format n
- }
- a : 0
- b : 1
- @ 0 .. n {
- c : b
- b : a + b
- a : c
- }
- a
-}
-
-`export fib_array : {[I64.n]
- ? {
- n < 0 {
- `return.error ~ "#BOLD#RED#Invalid n Got %#" `format n
- }
- n > 0 { n :- 1 }
- }
- arr : Array $ (0; 1)
- @ 0 .. n {
- arr `push + (arr `get -2; arr `get -1)
- }
- arr
-}