def slot_of

bendtorch-core@0.1.0.0 · src/storage/api.bend:253

import bendtorch-core@0.1.0.0/src/storage/api.bend as Api
import Base
import bendtorch-core@0.1.0.0/src/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/storage/arith.bend as Arith

253def slot_of(+d: Nat, +n: Nat, +i: U32, +fits: {Storage.bounds(d, n) == True{} : Bool},
254  +inside: {Nat.is_lt(U32.to_nat(i), n) == True{} : Bool}) -> {Nat.is_lt(U32.to_nat(i), Model.capacity(d)) == True{} : Bool}:
255  +rest = Arith.and_right(Nat.is_le(d, 20n), Bool.and(Nat.is_lt(0n, n), Nat.is_le(n, Model.capacity(d))), fits)
256  Arith.lt_le_trans(U32.to_nat(i), n, Model.capacity(d), inside,
257    Arith.and_right(Nat.is_lt(0n, n), Nat.is_le(n, Model.capacity(d)), rest))

Uses (11)

Used by (1)