diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-11-13 16:28:06 -0500 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-11-13 16:28:06 -0500 |
| commit | c5a80c0c4a1da4665da90a98eaf9f3870d18dd6b (patch) | |
| tree | aececbc71669dee6546e80164501b22a3a14ed0b /fib.kpl | |
| parent | 26dfb9719d8101cb12611209ac1004e66902aa86 (diff) | |
Diffstat (limited to 'fib.kpl')
| -rw-r--r-- | fib.kpl | 38 |
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 -} |
