Like with regular binary operators, deep binary operators can also be formulated as deep assignment operators, both with and without repetition suffix.
echo(new line, "Example on vectors:");
a[] = { 8, 4, 2, 1 };
b[] = { 1, 2, 3, 4 };
c[] = { 10, 11 };
d[] = c[];
e[] = c[];
a[] -^= b[]; // { 7, 2, -1, -3 }
echo(a[]);
c[] +^= b[]; // {11, 13, 3, 4}
echo(c[]);
d2[] +^:= b[]; // With repetition suffix: {11, 13, 13, 15}
echo(d[]);
e[] /^= 2; // With a scalar: { 5, 5.5 }
echo( e[] );
echo(new line, "Example on matrices:");
a[] = { { 8, 7, 6 }, { 1, 2, -1 }, { -5, 4, 6 } };
a orig[] = a[];
a[] -^^= 1; // Subtract 1 from all elements
echo matrix( "0", 3, " | ", a orig[], " - 1 = ", a[] );
a[] = a orig[];
b[] = { { 1,1,1}, {2,2,2}, {3,3,3} };
a[] *^^= { { 1,1,1}, {2,2,2}, {3,3,3} };
echo matrix( "0", 3, " | ", a orig[], " * ", b[], " = ", a[] );
Example on vectors:
{7,2,-1,-3}
{11,13,3,4}
{10,11}
{5,5.5}
Example on matrices:
| 8 7 6 | | 7 6 5 |
| 1 2 -1 | - 1 = | 0 1 -2 |
| -5 4 6 | | -6 3 5 |
| 8 7 6 | | 1 1 1 | | 8 7 6 |
| 1 2 -1 | * | 2 2 2 | = | 2 4 -2 |
| -5 4 6 | | 3 3 3 | | -15 12 18 |
Deep assignment operators are not possible on table cells if they are targets because with standard table configuration settings: Strings and numerals. It works if the left-hand value is a numeral and the right-hand value a set. In this case, the set will then be converted to a string representation and written to the table cell.
table create( t );
[t:0,0] = 10;
[t:0,1] = "Hi ";
[t:0,0] *^= { 5, 6, 7, 8 };
[t:0,1] +^= { volks, everyone, to all of you };
table list ( t ); // Sets have been converted to strings.
0 : {50,60,70,80}
1 : {'Hi volks','Hi everyone','Hi to all of you'}