For example with two arrays of the same length we could allow:
a = Array('int6', [1, 2, 3])
b = Array('int6', [5, 5, 5])
c = a + b # Array('int6', [6, 7, 8])
which would make a new Array with elements that are sum of the other Array elements. Nothing too radical there, but it does mean that we can't use + to concatenate Arrays like we are currently. I don't really like how + has two meanings whereas -, * etc only have one, so I'm tempted to remove the + = concatenate meaning right now. You can still always extend after all.
So basically whenever we have op(array1, array2) we would try to apply that op on the elements of each array, if that makes sense.
Interesting questions arise if the formats of the two arrays are not the same - how do we determine the resultant format for operations that aren't in-place?
For example with two arrays of the same length we could allow:
which would make a new Array with elements that are sum of the other Array elements. Nothing too radical there, but it does mean that we can't use
+
to concatenate Arrays like we are currently. I don't really like how+
has two meanings whereas-
,*
etc only have one, so I'm tempted to remove the+
= concatenate meaning right now. You can still alwaysextend
after all.So basically whenever we have
op(array1, array2
) we would try to apply thatop
on the elements of each array, if that makes sense.Interesting questions arise if the formats of the two arrays are not the same - how do we determine the resultant format for operations that aren't in-place?