From 9b69ee08be97ae238c193136f67f6071bd5abf6b Mon Sep 17 00:00:00 2001 From: mryouse Date: Wed, 20 Jul 2022 02:54:19 +0000 Subject: WIP add multifunc to boolean --- neb/std/boolean.py | 11 ++++++++--- 1 file 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) -- cgit v1.2.3