times operator can now execute a quotation 0 times (ref: #176)
h3rald h3rald@h3rald.com
Tue, 28 Dec 2021 20:53:00 +0000
1 files changed,
4 insertions(+),
5 deletions(-)
jump to
M
minpkg/lib/min_lang.nim
→
minpkg/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")