summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'array.c')
-rw-r--r--array.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/array.c b/array.c
index 7efc1b0..a4bde78 100644
--- a/array.c
+++ b/array.c
@@ -335,7 +335,23 @@ fillelement(Array *a)
case AtypeInt: return mkscalarint(0);
case AtypeFloat: return mkscalarfloat(0);
case AtypeRune: return mkscalarrune(' ');
- case AtypeArray:
+ case AtypeMixed:{
+ Array *first = arrayitem(a, 0);
+ Array *fill = fillelement(first);
+ freearray(first);
+ return fill;
+ }
+ case AtypeArray:{
+ Array *b = duparrayshape(a, a->type);
+ for(int i = 0; i < b->size; i++){
+ Array *fill = fillelement(a->arraydata[i]);
+ Array *shape = fnShape(a->arraydata[i]);
+ b->arraydata[i] = fnReshape(shape, fill);
+ freearray(fill);
+ freearray(shape);
+ }
+ return b;
+ }
default:
print("Can't make fill element of array type %d\n", a->type);
exits(nil);