aboutsummaryrefslogtreecommitdiff
path: root/fib.kpl
diff options
context:
space:
mode:
Diffstat (limited to 'fib.kpl')
-rw-r--r--fib.kpl38
1 files changed, 0 insertions, 38 deletions
diff --git a/fib.kpl b/fib.kpl
deleted file mode 100644
index d6a7b0a..0000000
--- a/fib.kpl
+++ /dev/null
@@ -1,38 +0,0 @@
-
-// Fibonacci Example
-
-`export fib_recursive : `{[I64 n]
- ? n < 0 { `return.error $ "n Cannot Be Negative" }
- fib : `{[I64 n]
- ? {
- n = 0 { 0 }
- n < 2 { 1 }
- { + (fib `call n - 1; fib `call n - 2) }
- }
- }
- fib `call n
-}
-
-`export fib_loop : `{[I64 n]
- ? n < 0 { `return.error $ "n Cannot Be Negative" }
- a : 0
- b : 1
- @ 0 .. n {
- c : b
- b +: a
- a : c
- }
- a
-}
-
-`export fib_array : `{[I64 n]
- ? {
- n < 0 { `return.error $ "n Cannot Be Negative" }
- n > 1 { n -: 1 }
- }
- arr : Array (0; 1)
- @ 0 .. n {
- arr `push arr[-2] + arr[-1]
- }
- arr
-}