#include #include #include #include #include "apl9.h" Function inverse(Function f) { /* TODO figure out a good way to structure this code */ if(f.type == FunctypeOp && f.operator.type == OperatortypePrim && f.operator.code == 9 && f.operator.dyadic){ /* obverse */ Function newf = f; newf.operator.left = f.operator.right; newf.operator.right = f.operator.left; return newf; } Rune *msg = runesmprint("No inverse defined for %S", ppfunction(f)); throwerror(msg, EDomain); return f; }