diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/aoc1.stem | 9 | ||||
-rw-r--r-- | examples/fib.stem | 20 | ||||
-rw-r--r-- | examples/math.stem | 2 | ||||
-rw-r--r-- | examples/repl.stem | 6 | ||||
-rw-r--r-- | examples/simple.stem | 1 | ||||
-rw-r--r-- | examples/stdlib.stem | 29 |
6 files changed, 0 insertions, 67 deletions
diff --git a/examples/aoc1.stem b/examples/aoc1.stem deleted file mode 100644 index 16f739d..0000000 --- a/examples/aoc1.stem +++ /dev/null @@ -1,9 +0,0 @@ - -dsc -swap -isnum -char -0 -str - -read_str [ ] diff --git a/examples/fib.stem b/examples/fib.stem deleted file mode 100644 index de02b5c..0000000 --- a/examples/fib.stem +++ /dev/null @@ -1,20 +0,0 @@ -# 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 diff --git a/examples/math.stem b/examples/math.stem deleted file mode 100644 index 1a6f931..0000000 --- a/examples/math.stem +++ /dev/null @@ -1,2 +0,0 @@ -factorial [ dup 0 <= [ 1 + ] [ dup 1 - factorial * ] if ] func -PI 3.1415926 func diff --git a/examples/repl.stem b/examples/repl.stem deleted file mode 100644 index 6ed6795..0000000 --- a/examples/repl.stem +++ /dev/null @@ -1,6 +0,0 @@ -"./stdlib.stem" fread strquote eval -"./math.stem" include - -"You can make your own REPL by changing the code!" dsc - -repl [ "> " . read strquote eval repl ] func repl diff --git a/examples/simple.stem b/examples/simple.stem deleted file mode 100644 index 5853c3f..0000000 --- a/examples/simple.stem +++ /dev/null @@ -1 +0,0 @@ -3 4 + . diff --git a/examples/stdlib.stem b/examples/stdlib.stem deleted file mode 100644 index df81cd8..0000000 --- a/examples/stdlib.stem +++ /dev/null @@ -1,29 +0,0 @@ -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 > [ - swap - dup eval - 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 -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 |