Implemented foreach.
h3rald h3rald@h3rald.com
Sat, 17 Sep 2016 21:00:31 +0200
3 files changed,
13 insertions(+),
0 deletions(-)
M
lib/min_lang.nim
→
lib/min_lang.nim
@@ -372,6 +372,13 @@ i.push litem
i.unquote("<map-quotation>", prog) res.add i.pop i.push res.newVal + + .symbol("foreach") do (i: In): + var prog, list: MinValue + i.reqTwoQuotations prog, list + for litem in list.qVal: + i.push litem + i.unquote("<foreach-quotation>", prog) .symbol("times") do (i: In): var t, prog: MinValue
M
prelude.min
→
prelude.min
@@ -64,3 +64,7 @@ (dprint pop) :dprint!
(put pop) :put! (:ms :q :check (check) (ms sleep q) while) :interval (call pop) :call! + +; Load all stored symbols + +stored-symbols 'load-symbol foreach
M
tests/lang.min
→
tests/lang.min
@@ -157,6 +157,8 @@ (<sym1 symbols "sym1" contains) assert
('sym1 remove-symbol stored-symbols "sym1" contains false ==) assert + (0 :temp (1 2 3) (temp + @temp) foreach 6 temp ==) assert + report ; Tidy up ~defmod