def lookup_naturals
bendtorch-core@0.1.0.0 · src/tensor/axis_algebra.bend:259
import bendtorch-core@0.1.0.0/src/tensor/axis_algebra.bend as AxisAlgebra
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/tensor/axis_spec.bend as Axis
259def lookup_naturals(+items: List<&2, U32>, +index: Nat) ->
260 {natural_value(Axis.lookup(U32, items, index)) == Axis.lookup(Nat, Shape.naturals(items), index) : Maybe<&2, Nat>}:
261 match items index:
262 case Nil{} 0n:
263 {==}
264 case Nil{} 1n+p:
265 {==}
266 case head <> tail 0n:
267 {==}
268 case head <> +tail 1n+p:
269 lookup_naturals(tail, p)