all repos — min @ 6d828e9269d9a8b394f9ea9c79930ca72194fd03

A small but practical concatenative programming language.

added `product` function in Num module
drkameleon yaniszaf@gmail.com
Thu, 21 Jan 2021 18:30:09 +0100
commit

6d828e9269d9a8b394f9ea9c79930ca72194fd03

parent

8b2f844b9c02ee443c6dd1c196c853218ab3642f

1 files changed, 16 insertions(+), 0 deletions(-)

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

@@ -135,4 +135,20 @@ i.push c.int.newVal

else: i.push c.newVal + def.symbol("product") do (i: In): + var s: MinValue + i.reqQuotationOfNumbers s + var c = 1.float + var isInt = true + for n in s.qVal: + if n.isFloat: + isInt = false + c = c * n.floatVal + else: + c = c * n.intVal.float + if isInt: + i.push c.int.newVal + else: + i.push c.newVal + def.finalize("num")