diff options
| author | mryouse | 2022-07-07 02:04:28 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-07 02:04:28 +0000 |
| commit | f4622e734ef2be1c3793113e93219d593e3e11fb (patch) | |
| tree | 2c37586c7583d42c3e3ad98b522f23c0003089f9 /neb/std/boolean.py | |
| parent | 276dd853729a7c71ef4805786793bbc8f651b00d (diff) | |
refactor move all functions with 'lazy' to core
Diffstat (limited to 'neb/std/boolean.py')
| -rw-r--r-- | neb/std/boolean.py | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/neb/std/boolean.py b/neb/std/boolean.py index 973fa67..e716a87 100644 --- a/neb/std/boolean.py +++ b/neb/std/boolean.py @@ -3,31 +3,6 @@ from ..structs import * BOOLEAN = Environment() -def interpretOr(symbol, args, env, ns): - # or returns true for the first expression that returns true - for arg in args: - ev = evaluate(arg, env, ns) - if not isinstance(ev, Bool): - raise InterpretPanic(symbol, "requires :bool arguments") - if ev.value == True: - return ev - return Bool(False) - -or_arg = Arg("arg", TypeEnum.BOOL, lazy=True) -BOOLEAN.register("or", Builtin("or", interpretOr, [or_arg, or_arg], or_arg, Type(":bool"))) - -def interpretAnd(symbol, args, env, ns): - # and returns false for the first expression that returns false - for arg in args: - ev = evaluate(arg, env, ns) - if not isinstance(ev, Bool): - raise InterpretPanic(symbol, "requires :bool arguments") - if ev.value == False: - return ev - return Bool(True) - -BOOLEAN.register("and", Builtin("and", interpretAnd, [or_arg, or_arg], or_arg, Type(":bool"))) - def interpretEq(symbol, args, env, ns): # NOTE this currently only works for literals # compare types because 0 != #false in neb |
