Access arrays in memory order, along columns

This is going to fail, since i-1 and i+1 must necessarily go out of bounds at the edges. You’ll have to figure out some way to peel of the edge values.

pairs will give you the value and the index/indices. Enumerate will just count from one, so it depends on what you need. If you are looking for indices, use pairs.

2 Likes