def counted
import bendtorch-core@0.1.0.0/src/tensor/slice.bend as Sliceimport Base
56# How many of 0, step, 2 step, ... lie below `span`: none for an empty span,
57# else 1 + (span - 1) / step, a ceiling division that never forms a number
58# past span. It takes one division, not a step per index.
59def counted(+span: Nat, +step: Nat) -> Nat:
60 match span:
61 case 0n:
62 0n
63 case 1n+rest:
64 1n+Nat.div(rest, step)