aboutsummaryrefslogtreecommitdiff
path: root/interpreter.py
diff options
context:
space:
mode:
authormryouse2022-06-15 04:39:57 +0000
committermryouse2022-06-15 04:39:57 +0000
commitcd36d92b2a64ba48421f97c1ca3ce478d0ecd8c2 (patch)
tree697808a0f13b543cb58ef7c1a9d51722c9ae379e /interpreter.py
parent006ae57991d2685c489a8b5dae71da29defc7fc7 (diff)
implement floor
Diffstat (limited to 'interpreter.py')
-rw-r--r--interpreter.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/interpreter.py b/interpreter.py
index 067681f..63b9187 100644
--- a/interpreter.py
+++ b/interpreter.py
@@ -10,6 +10,7 @@ import subprocess
import shlex
import random
import sys
+import math
@dataclass
@@ -849,3 +850,8 @@ def interpretUseAs(symbol, args, env, ns):
# TODO takes a symbol as its second, that may be wrong
GLOBALS.register("use-as", Builtin(interpretUseAs, [Arg("filename", TypeEnum.STRING, False, False), Arg("namespace", TypeEnum.ANY, False, True)]))
+
+def interpretFloor(symbol, args, env, ns):
+ return Int(math.floor(args[0].value))
+
+GLOBALS.register("floor", Builtin(interpretFloor, [Arg("floor", TypeEnum.NUMBER, False, False)]))