SliceLAWS.clamp: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/tensor/slice_LAWS.bend as SliceLAWS Lines 124-127 of bendtorch-core@0.1.0.0/src/tensor/slice_LAWS.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/tensor/slice_LAWS.bend&start_line=124&end_line=127 import Base # PyTorch's clamp of a slice position to an axis of extent n: the position # if it is at most n, else n. def clamp(+position: Nat, +extent: Nat) -> Nat: Bool.pick(Nat, Nat.is_le(position, extent), position, extent) Uses (3): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat.is_le