aboutsummaryrefslogtreecommitdiff
path: root/stemlib/fib.stem
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-20 02:38:26 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-20 02:38:26 -0800
commita9d6c221d7686e3055593359b02125a3f20ab3e5 (patch)
treeea9037ae83c28910f5fddf4844ffbb9563dbf94e /stemlib/fib.stem
parent640f9a3f5be5528dd4f8ed658cfe4d06d833e4c9 (diff)
add map, filter might work?
Diffstat (limited to 'stemlib/fib.stem')
-rw-r--r--stemlib/fib.stem20
1 files changed, 20 insertions, 0 deletions
diff --git a/stemlib/fib.stem b/stemlib/fib.stem
new file mode 100644
index 0000000..de02b5c
--- /dev/null
+++ b/stemlib/fib.stem
@@ -0,0 +1,20 @@
+# Author: Andrei Sova 2023
+fib [
+ dup 1 <= [ ] [
+ dup 1 - fib
+ swap
+ dup 2 - fib
+ swap
+ dsc
+ +
+ ] if
+] func
+
+main [
+ dup 10 <= [
+ dup fib .
+ 1 + main
+ ] [ exit ] if
+] func
+
+0 main