aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-10 11:08:48 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-10 11:08:48 -0800
commit08d3ca49897c85c71e7a66ce8902bbf04081c441 (patch)
tree5e3160dbae96d940eccb4a66b0219c16cb877b61 /examples
parent3802eec07ec36a55815468a442add5debbbe7fb6 (diff)
fix dip
Diffstat (limited to 'examples')
-rw-r--r--examples/fib.stem19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/fib.stem b/examples/fib.stem
new file mode 100644
index 0000000..4104a36
--- /dev/null
+++ b/examples/fib.stem
@@ -0,0 +1,19 @@
+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