def masked
bendtorch-core@0.1.0.0 · src/autograd/reduce_fiber_proof.bend:236
import bendtorch-core@0.1.0.0/src/autograd/reduce_fiber_proof.bend as ReduceFiberProof
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
236
237
238
239def masked(fuel: Nat, +rows: List<&2, Shape.Row>, +target: Nat, +base: Nat, +cursor: Nat) -> List<&2, Nat>:
240 match fuel:
241 case 0n:
242 Nil{}
243 case 1n+rest:
244 kept(Nat.is_eq(Shape.walk_left(rows, cursor), target), Nat.add(base, Shape.walk_right(rows, cursor)),
245 masked(rest, rows, target, base, 1n+cursor))