blob: 20628e49e571fa8d8f02b154938eea7c53464eb1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <thread.h>
#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;
}
|