diff options
Diffstat (limited to 'examples/stdlib.stem')
-rw-r--r-- | examples/stdlib.stem | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/stdlib.stem b/examples/stdlib.stem index a063c9b..df81cd8 100644 --- a/examples/stdlib.stem +++ b/examples/stdlib.stem @@ -1,6 +1,9 @@ evalstr [ strquote eval ] func include [ fread evalstr ] func +# Author: Preston Pan +neg [ 0 swap - ] func + # Author of loop function: Andrei S loop [ swap dup 0 > [ @@ -15,6 +18,12 @@ dupd [ [ dup ] keep ] func over [ dupd swap ] func dup2 [ over over ] func dip2 [ swap [ dip ] dip ] func +while [ dup2 [ [ ] if ] dip2 over [ while ] [ dsc dsc ] if ] func loop-times [ dup2 [ swap [ ] if ] dip2 dup [ 1 - loop-times ] [ dsc dsc ] if ] func + +d>base [ [ pow * "" swap ] keep2 + +[ [ over ] [ [ dup2 / floor * swap over - ] keep [ [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "↊" "↋" ] vat swap + ] with dip2 ] while dsc2 dup len(str-len) ] dip +- dup2 tail [ head "." ] dip + + ] func |