Copy and pasting blocks? That's a red flag right there, remember that next time you're doing it, and think how you could do it without the copy and pasting
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.)