Ensuring that a quotation of integers is processed by range (#115).
h3rald h3rald@h3rald.com
Sat, 30 Jan 2021 20:28:20 +0000
2 files changed,
9 insertions(+),
1 deletions(-)
M
minpkg/core/utils.nim
→
minpkg/core/utils.nim
@@ -321,6 +321,14 @@ raiseInvalid("A quotation is required on the stack")
for s in a.qVal: if not s.isNumber: raiseInvalid("A quotation of numbers is required on the stack") + +proc reqQuotationOfIntegers*(i: var MinInterpreter, a: var MinValue) = + a = i.pop + if not a.isQuotation: + raiseInvalid("A quotation is required on the stack") + for s in a.qVal: + if not s.isInt: + raiseInvalid("A quotation of integers is required on the stack") proc reqQuotationOfSymbols*(i: var MinInterpreter, a: var MinValue) = a = i.pop
M
minpkg/lib/min_num.nim
→
minpkg/lib/min_num.nim
@@ -219,7 +219,7 @@ i.push ((first.intVal+second.intVal).float/2).newVal
def.symbol("range") do (i: In): var s: MinValue - i.reqQuotationOfNumbers s + i.reqQuotationOfIntegers s var a = s.qVal[0] var b = s.qVal[1] var step = 1.newVal