summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/functions.c b/functions.c
index b2e4d9f..576fc4c 100644
--- a/functions.c
+++ b/functions.c
@@ -579,7 +579,7 @@ fnSplit(Array *right)
{
Rune *code = L"0≡≢⍴⍵: ⍵ ⋄ 1≡≢⍴⍵: ⊂⍵ ⋄ (⊂⍵)⌷⍨¨⍳¯1↓⍴⍵";
Array *result = rundfn(code, nil, nil, nil, right);
- if(GetSize(result) == 0)
+ if(GetSize(result) == 0 && GetType(result) == AtypeArray)
result->prototype = rundfn(L"⊂(⊃⌽⍴⍵)↑⎕proto ⍵", nil, nil, nil, right);
return result;
}
@@ -1327,7 +1327,7 @@ fnTake(Array *left, Array *right)
for(i = 0; i < GetRank(right); i++)
result->shape[i] = shape[i];
- if(size == 0)
+ if(size == 0 && GetType(result) == AtypeArray)
result->prototype = fnSame(fill);
int *index = emallocz(sizeof(int) * GetSize(left), 1);
@@ -1788,7 +1788,7 @@ fnCatenateFirst(Array *left, Array *right)
freearray(leftarr);
freearray(rightarr);
- if(GetSize(result) == 0)
+ if(GetSize(result) == 0 && GetType(result) == AtypeArray)
result->prototype = fillelement(left);
return result;
}
@@ -1805,7 +1805,7 @@ fnReshape(Array *left, Array *right)
return arrayitem(right, 0);
Array *res = allocarray(GetType(right), GetSize(left), size);
- if(size == 0)
+ if(size == 0 && GetType(res) == AtypeArray)
res->prototype = fillelement(right);
for(i = 0; i < GetSize(left); i++)