diff options
Diffstat (limited to 'operators.c')
-rw-r--r-- | operators.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/operators.c b/operators.c index 1ecb8aa..2d26251 100644 --- a/operators.c +++ b/operators.c @@ -5,7 +5,7 @@ #include "apl9.h" Rune primmonopnames[] = L"¨⍨⌸⌶&∆"; -Rune primdyadopnames[] = L"⍣.∘⍤⍥@⍠⌺⍙"; +Rune primdyadopnames[] = L"⍣.∘⍤⍥@⍠⌺⍢⍫⍙"; opmonad monadoperatordefs[] = { opEach, /* ¨ */ @@ -25,6 +25,8 @@ opdyad dyadoperatordefs[] = { 0, /* @ */ 0, /* ⍠ */ 0, /* ⌺ */ + opUnder, /* ⍢ */ + opObverse, /* ⍫ */ opSelfReference2, /* ⍙ */ }; @@ -191,6 +193,25 @@ opAtop(Datum *lefto, Datum *righto, Array *left, Array *right) } Array * +opUnder(Datum *lefto, Datum *righto, Array *left, Array *right) +{ + if(lefto->tag != FunctionTag || righto->tag != FunctionTag) + throwerror(L"⍢ operands must be functions", EDomain); + if(left) + return rundfn(L"⍹⍣¯1 ⊢ (⍹ ⍺) ⍶ ⍹ ⍵", lefto, righto, left, right); + else + return rundfn(L"⍹⍣¯1 ⍶ ⍹ ⍵", lefto, righto, left, right); +} + +Array * +opObverse(Datum *lefto, Datum *righto, Array *left, Array *right) +{ + if(lefto->tag != FunctionTag || righto->tag != FunctionTag) + throwerror(L"⍫ operands must be functions", EDomain); + return runfunc(lefto->func, left, right); +} + +Array * opOver(Datum *lefto, Datum *righto, Array *left, Array *right) { if(lefto->tag != FunctionTag || righto->tag != FunctionTag) |