summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/functions.c b/functions.c
index df90cf4..24fefa9 100644
--- a/functions.c
+++ b/functions.c
@@ -441,6 +441,11 @@ fnUniqueMask(Array *right)
res->intdata[0] = 1;
return res;
}
+ if(right->size == 0){
+ Array *res = allocarray(AtypeInt, 1, 0);
+ res->shape[0] = 0;
+ return res;
+ }
return rundfn(L"(⍳≢⍵)≤⊃∘⍸¨↓≡⌾⍨⌷∘⍵¨⍳≢⍵", nil, nil, nil, right);
}
@@ -1500,6 +1505,12 @@ fnIntervalIndex(Array *left, Array *right)
Array *
fnMembership(Array *left, Array *right)
{
+ if(right->size == 0)
+ return rundfn(L"(⍴⍵)⍴0", nil, nil, nil, left);
+
+ if(right->rank == 0)
+ return rundfn(L"⍺∊,⍵", nil, nil, left, right);
+
/* TODO avoid outer product */
return rundfn(L"∨/⍺≡⌾⍵", nil, nil, left, right);
}