A micropackage implementing a snaking iterator for use with 2D arrays.
See the diagram below for a comparison of normal column-wise (Julia default) iteration versus snaking iteration. It can handle iteration of arbitrary 2D arrays.
A common use case is minimizing the time spent on physical movement between consecutive wells when iterating over a multiwell plate. This is useful for programming robots to handle 96-well or 386-well plates during microscopy, liquid handling, etc
First, install the package from the General registry
using Pkg Pkg.add("SnakeIterator")
The only exported function is
snake and it constructs a
should just work (tm) like any other iterator.
using SnakeIterator arr = reshape(1:16, 4, 4) for i in snake(arr) @show i end