summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-29 00:09:53 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-29 00:09:53 +0000
commit0f3b415b3177a6b73828c09090cfae3a9c6dd5c9 (patch)
treee736e3cc0dab43f2d7801c1866a0c3b592f580a4 /functions.c
parentb4ab528e1995ab7017b55a899d970feee0c74edb (diff)
Handle scalars in monadic ≠ and ∪
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/functions.c b/functions.c
index ed0fb36..2425798 100644
--- a/functions.c
+++ b/functions.c
@@ -369,6 +369,13 @@ fnSame(Array *right)
Array *
fnUniqueMask(Array *right)
{
+ if(right->rank == 0){
+ Array *res = allocarray(AtypeInt, 1, 1);
+ res->shape[0] = 1;
+ res->intdata[0] = 1;
+ return res;
+ }
+
return rundfn(L"(⍳≢⍵)≤⊃∘⍸¨↓≡⌾⍨⌷∘⍵¨⍳≢⍵", nil, nil, nil, right);
}
@@ -620,6 +627,9 @@ fnEnlist(Array *right)
Array *
fnUnique(Array *right)
{
+ if(right->rank == 0)
+ return fnRavel(right);
+
return rundfn(L"(≠⍵)⌿⍵", nil, nil, nil, right);
}