all repos — min @ d0e1ba8058973b54e3b1e14ca6b065b9662df194

A small but practical concatenative programming language.

Implemented foreach.
h3rald h3rald@h3rald.com
Sat, 17 Sep 2016 21:00:31 +0200
commit

d0e1ba8058973b54e3b1e14ca6b065b9662df194

parent

0e3b6568b42f420ddedf2a06ef7c28f390d6557f

3 files changed, 13 insertions(+), 0 deletions(-)

jump to
M lib/min_lang.nimlib/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.minprelude.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.mintests/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