From 77b1638d64046ec960347b9054da3111f975e807 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Wed, 14 Sep 2022 21:09:20 -0700 Subject: [PATCH] Check for minus before converting to int. BigInts converts "-" to 0. This happens in the parser before you get to the evaluator. --- implementations/Nim/joy.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/implementations/Nim/joy.nim b/implementations/Nim/joy.nim index 5e5ee98..16b5b91 100644 --- a/implementations/Nim/joy.nim +++ b/implementations/Nim/joy.nim @@ -270,6 +270,8 @@ proc text_to_expression(text: string): JoyListType = thing = j_true elif tok == "false": thing = j_false + elif tok == "-": # see https://github.com/nim-lang/bigints/issues/116 + thing = JoyType(kind: joySymbol, symVal: tok) else: try: thing = JoyType(kind: joyInt, intVal: tok.initBigInt)