aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Pan <preston@nullring.xyz>2024-01-12 19:05:03 -0800
committerPreston Pan <preston@nullring.xyz>2024-01-12 19:05:03 -0800
commit9573dffae70e9d674dec84082ddc162f7f7eb418 (patch)
tree1664f55e8ab8eb10ec796713fc0cb72be8aa7c25
parent50c4723dee869078ebb00f1ced484686f38430dc (diff)
add functions
-rw-r--r--examples/stdlib.stem9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/stdlib.stem b/examples/stdlib.stem
index 00a4f67..a063c9b 100644
--- a/examples/stdlib.stem
+++ b/examples/stdlib.stem
@@ -9,3 +9,12 @@ loop [
swap 1 - swap loop
] [ dsc dsc ] if
] func
+
+# Author: Matthew H
+dupd [ [ dup ] keep ] func
+over [ dupd swap ] func
+dup2 [ over over ] func
+dip2 [ swap [ dip ] dip ] func
+
+loop-times [ dup2 [ swap [ ] if ] dip2
+dup [ 1 - loop-times ] [ dsc dsc ] if ] func