robpike / ivy

ivy, an APL-like calculator
Other
1.32k stars 103 forks source link

ivy: fix indexed assignment bugs #75

Closed rsc closed 2 years ago

rsc commented 2 years ago

Formerly:

x = iota 3; x[1+2] = 4; x
rank error assigning (4) to x[1 + 2]

x = 4 4 rho 0; y = 4 4; x[y[1]][y[2]] = 3; x
0 3 0 0
0 0 0 0
0 0 0 0
0 0 0 0

Now:

x = iota 3; x[1+2] = 4; x
1 2 4

x = 4 4 rho 0; y = 4 4; x[y[1]][y[2]] = 3; x
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 3