3 ms·
How would you do it in many of those cases? For instance: ax[i] = bx[i] ay[i] = by[i] az[i] = bz[i] Can the languages used write this in a better way?
by MichaelGG 12y ago
How would you do it in many of those cases? For instance:
ax[i] = bx[i]
ay[i] = by[i]
az[i] = bz[i]
Can the languages used write this in a better way?
I do agree that having inner functions and making them easy to define is better, but it's not always possible. In F# I could write:
let assign i (a,b) = a[i] <- b[i]
[ax,bx; ay,by; az,bz] |> Seq.iter (assign i)
But that's allocating a list (and if I closed over i, it'd allocate a closure too). Really good macro support would fix this, though. And it's only marginally better in this case. (For more elaborate cases it might be easier to scan.)