all repos — min @ 4e9a1cb02873eeefb9f08f3c6b6b4cf20b98ffff

A small but practical concatenative programming language.

Ensuring that a quotation of integers is processed by range (#115).
h3rald h3rald@h3rald.com
Sat, 30 Jan 2021 20:28:20 +0000
commit

4e9a1cb02873eeefb9f08f3c6b6b4cf20b98ffff

parent

fb1ce683121ff94e869c64c0248bbf318a24fbe8

2 files changed, 9 insertions(+), 1 deletions(-)

jump to
M minpkg/core/utils.nimminpkg/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.nimminpkg/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