Implemented dip and mod symbols.
h3rald h3rald@h3rald.com
Sat, 02 Dec 2023 14:38:37 +0000
3 files changed,
16 insertions(+),
3 deletions(-)
M
docs/about.md
→
docs/about.md
@@ -40,7 +40,7 @@ * does not have a fancy REPL with autocompletion
What *does* it have then? Well, {{m}} provides: -* exactly 70 symbols, nearly all of which are borrowed from min +* exactly 72 symbols, nearly all of which are borrowed from min * file reading/writing (via the {#link-symbol||read#} and {#link-symbol||write#} symbols) * stdin reading ({#link-symbol||gets#}) and writing ({#link-symbol||puts#}) * external command execution via {#link-symbol||run#} and automatic command expansion for all strings wrapped in square brackets
M
mnpkg/lang.nim
→
mnpkg/lang.nim
@@ -223,6 +223,13 @@
def.symbol("dup") do (i: In): i.push i.peek + def.symbol("dip") do (i: In): + let vals = i.expect("quot", "a") + var q = vals[0] + let v = vals[1] + i.dequote(q) + i.push v + def.symbol("swap") do (i: In): let vals = i.expect("a", "a") let a = vals[0]@@ -407,6 +414,12 @@ i.push newVal(Inf)
def.symbol("-inf") do (i: In): i.push newVal(NegInf) + + def.symbol("mod") do (i: In): + let vals = i.expect("int", "int") + let b = vals[0] + let a = vals[1] + i.push(newVal(a.intVal mod b.intVal)) def.symbol("+") do (i: In): let vals = i.expect("num", "num")
M
tasks/build.mn
→
tasks/build.mn
@@ -9,7 +9,7 @@ (target_os "windows" ==)
(".exe" (ext) bind) when "Building mn - $# (x64) - $#" (target_os stage) interpolate puts pop - "nim c -d:$# --os:$# --gc:orc --deepcopy:on --opt:size mn" (stage target_os) interpolate (cmd) let + "nim c -d:$# --os:$# --mm:orc --deepcopy:on --opt:size mn" (stage target_os) interpolate (cmd) let cmd puts pop cmd run "tar -czvf $#.tar.gz mn$#" (o ext) interpolate run@@ -35,4 +35,4 @@ ) (build__linux) lambda
( "macosx" "release" compile -) (build__macosx) lambda+) (build__macosx) lambda