From 57a86f761605b6261d1045558c9cb7c83d723b60 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Tue, 25 Jan 2022 19:28:31 +0000 Subject: =?UTF-8?q?Add=20under=20=E2=8D=A2=20and=20obverse=20=E2=8D=AB=20T?= =?UTF-8?q?each=20inverse()=20that=20the=20inverse=20of=20f=E2=8D=ABg=20is?= =?UTF-8?q?=20g=E2=8D=ABf=20=07?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inverse.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'inverse.c') diff --git a/inverse.c b/inverse.c index b37664b..c20e78d 100644 --- a/inverse.c +++ b/inverse.c @@ -7,6 +7,15 @@ 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; -- cgit v1.2.3