Moved num-related operators out of prelude.
h3rald h3rald@h3rald.com
Fri, 24 Mar 2017 21:16:39 +0100
3 files changed,
21 insertions(+),
9 deletions(-)
M
lib/min_num.nim
→
lib/min_num.nim
@@ -79,4 +79,24 @@ var a, b: MinValue
i.reqTwoInts b, a i.push(newVal(a.intVal mod b.intVal)) + .symbol("succ") do (i: In): + var n: MinValue + i.reqInt n + i.push newVal(n.intVal + 1) + + .symbol("pred") do (i: In): + var n: MinValue + i.reqInt n + i.push newVal(n.intVal - 1) + + .symbol("even?") do (i: In): + var n: MinValue + i.reqInt n + i.push newVal(n.intVal mod 2 == 0) + + .symbol("odd?") do (i: In): + var n: MinValue + i.reqInt n + i.push newVal(n.intVal mod 2 != 0) + .finalize()
M
prelude.min
→
prelude.min
@@ -8,14 +8,6 @@ 'time import
'fs import 'crypto import -; Mathematical Operators -(1 +) :succ -(1 -) :pred -(2 mod 0 ==) :even? -(even? not) :odd? - -('succ 'pred 'even? 'odd?) 'seal foreach - ; Stack Operators (swap cons) :swons ((pop) dip) :popd
M
tests/lang.min
→
tests/lang.min
@@ -181,7 +181,7 @@ ('sym1 remove-symbol stored-symbols "sym1" contains false ==) assert
(0 :temp (1 2 3) (temp + @temp) foreach 6 temp ==) assert - ('succ source (1 +) ==) assert + ((1 +) :mysucc 'mysucc source (1 +) ==) assert (6 (