PSA: replacement of ind2sub/sub2ind in Julia 0.7+

Slightly off topic: How would one now write the boxcar3 example in your blog post Multidimensional algorithms and iteration? Over in slack it was suggested by Simon Schoelly to replace
for J in CartesianRange(max(I1, I-I1), min(Iend, I+I1)) with
for J in CartesianIndices(UnitRange.( max(I1, I-I1).I , min(Iend, I+I1).I )). Works but seems a bit ugly, maybe there is a better way?

(Also, maybe that blog post could/should be updated to 1.0 as it is linked from the docs?)

5 Likes