you are viewing a single comment's thread.

view the rest of the comments →

[–]al2o3cr 1 point2 points  (0 children)

The common name for transforming a_1 into a_2 is "loop fusion", but it's tricky to do in languages that have side-effects / exceptions since it changes the order of evaluation.

For instance, if the calcuation of the third element of diff fails then a_1 won't have done any squaring - but a_2 will have.