From 80ebae7887e21f58ef09a18515e5521c5162053c Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Fri, 21 Jan 2022 16:05:41 +0000 Subject: Get ready for hybrids --- functions.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 3e5c902..3d62828 100644 --- a/functions.c +++ b/functions.c @@ -158,6 +158,13 @@ runfunc(Function f, Array *left, Array *right) } return m(right); } + }else if(f.type == FunctypeOp && f.operator.type == OperatortypeHybrid){ + opmonad m = hybridoperatordefs[f.operator.code]; + if(m == nil){ + Rune *err = runesmprint("monadic %C", primhybridnames[f.operator.code]); + throwerror(err, ENotImplemented); + } + return m(f.operator.left, left, right); }else if(f.type == FunctypeOp){ /* TODO assumes prim op, not dop */ if(f.operator.dyadic){ @@ -189,6 +196,13 @@ runfunc(Function f, Array *left, Array *right) } return f.quad->monadfn(right); } + }else if(f.type == FunctypeHybrid){ + fndyad d = hybridfunctiondefs[f.code]; + if(d == nil){ + Rune *err = runesmprint("dyadic %C", primhybridnames[f.code]); + throwerror(err, ENotImplemented); + } + return d(left, right); }else return nil; } -- cgit v1.2.3