diff options
| author | mryouse | 2022-07-20 02:54:19 +0000 |
|---|---|---|
| committer | mryouse | 2022-07-20 02:54:19 +0000 |
| commit | 9b69ee08be97ae238c193136f67f6071bd5abf6b (patch) | |
| tree | ed55966a619b5626a12379c59fa7381c4fe01726 /neb | |
| parent | eb021d2ea4227dd06a4e4b39c2be333f94d210f8 (diff) | |
WIP add multifunc to boolean
Diffstat (limited to 'neb')
| -rw-r--r-- | neb/std/boolean.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/neb/std/boolean.py b/neb/std/boolean.py index 1c8b8ae..f9326ee 100644 --- a/neb/std/boolean.py +++ b/neb/std/boolean.py @@ -1,4 +1,4 @@ -from .. import TypeEnum, Environment, Arg, Builtin, evaluate, InterpretPanic, TypeWrap +from .. import TypeEnum, Environment, Arg, Builtin, evaluate, InterpretPanic, TypeWrap, MultiFunction from ..structs import * BOOLEAN = Environment() @@ -22,11 +22,16 @@ def interpretEq(symbol, args, env, ns): raise InterpretPanic(symbol, "unknown comparison type", args[0]) eq_arg = Arg("value", TypeEnum.ANY) -BOOLEAN.register("eq?", Builtin("eq?", interpretEq, [eq_arg, eq_arg], return_type=Type(":bool"))) +eq_func = Builtin("eq?", interpretEq, [eq_arg, eq_arg], return_type=Type(":bool")) +eq_multi = MultiFunction("eq?") +eq_multi.register(eq_func) +BOOLEAN.register("eq?", eq_multi) def interpretNot(symbol, args, env, ns): return Bool(not args[0].value) not_arg = Arg("not", TypeEnum.BOOL) -BOOLEAN.register("not", Builtin("not", interpretNot, [not_arg], return_type=Type(":bool"))) +not_func = Builtin("not", interpretNot, [not_arg], return_type=Type(":bool")) +not_multi = MultiFunction("not") +BOOLEAN.register("not", not_multi) |
