all repos — min @ 7aea3e824d552d88e04a35bbc1f249f3685d5385

A small but practical concatenative programming language.

times operator can now execute a quotation 0 times (ref: #176)
h3rald h3rald@h3rald.com
Tue, 28 Dec 2021 20:53:00 +0000
commit

7aea3e824d552d88e04a35bbc1f249f3685d5385

parent

9d8d492e978f7ffe084b8875f21871e69557278f

1 files changed, 4 insertions(+), 5 deletions(-)

jump to
M minpkg/lib/min_lang.nimminpkg/lib/min_lang.nim

@@ -869,12 +869,11 @@ i.dequote(prog)

def.symbol("times") do (i: In): let vals = i.expect("int", "quot") - var t = vals[0] + var t = vals[0].intVal var prog = vals[1] - if t.intVal < 1: - raiseInvalid("A non-zero natural number is required") - for c in 1..t.intVal: - i.dequote(prog) + if t > 0: + for c in 1..t: + i.dequote(prog) def.symbol("while") do (i: In): let vals = i.expect("quot", "quot")