Essentially a short-circuiting version of Iterator::fold() (see
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.fold). The only difference
between this and Iterator::fold() is that the closure in this function returns two values: the
accumulator value and a boolean. If the boolean returned is true, fold_while() will continue
iterating, otherwise it will terminate early.
Increments a “selector” slice of booleans. Essentially treats the slice as a binary number and
increments it. Returns true if the input is already all true and doesn’t increment. Returns
false and increments otherwise.
Given 2-dimensional data and a predicate, position_2d() returns the position (ie, the 2D
indices) of where the predicate first returned true, or None if the predicate never returns
true. The input data is interpreted as follows: