TensorView.locate: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/tensor_view.bend as TensorView Lines 39-46 of stelliferous@0.0.2.0/tensor_view.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/tensor_view.bend&start_line=39&end_line=46 import Base # The recursive step consumes one axis and one coordinate; no flattening/copy. def locate(axes: List<&2,Axis>,coordinates: List<&2,U32>,address: Maybe<&2,U32>,+logical_length: U32) -> Maybe<&2,U32>: match axes coordinates address: case Nil{} Nil{} Some{+offset}: finish_address(U32.is_lt(offset,logical_length),offset) case Con{Axis{+extent,stride},tail} Con{+coordinate,rest} Some{+offset}: locate(tail,rest,advance_inside(U32.is_lt(coordinate,extent) && U32.is_lt(offset,logical_length),offset,coordinate,stride,logical_length),logical_length) case axes coordinates address: None{} Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_view.bend&name=Axis https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_view.bend&name=advance_inside https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_view.bend&name=finish_address