Refinement.swap_go: def of bendtorch-core@0.1.0.0 Import: import bendtorch-core@0.1.0.0/src/storage/refinement.bend as Refinement Lines 159-178 of bendtorch-core@0.1.0.0/src/storage/refinement.bend: https://jend.leeeet.dev/read.txt?path=bendtorch-core@0.1.0.0/src/storage/refinement.bend&start_line=159&end_line=178 import Base import bendtorch-core@0.1.0.0/src/storage/model.bend as Model def swap_go(-T: Data, d: Nat, array: Array, +n: U32, +i: U32, new: T, z: Bool, valid: Model.Balanced(T, d, array)) -> Swap: match d array z: case 0n ALeaf{old} _: Swap{ALeaf{new}, old, {==}, {==}, {==}, valid} case 0n ANode{xs, ys} _: match valid: case 1n+p ALeaf{old} _: match valid: case 1n+p ANode{xs, ys} True{}: (ex, ey) = valid swap_low(T, p, xs, n, i, new, ys, swap_go(T, p, xs, U32.shr(n), i, new, U32.is_lt(i, U32.shr(U32.shr(n))), ex), ey) case 1n+p ANode{xs, ys} False{}: (ex, ey) = valid +j = U32.sub(i, U32.shr(n)) swap_high(T, p, ys, n, i, new, xs, swap_go(T, p, ys, U32.shr(n), j, new, U32.is_lt(j, U32.shr(U32.shr(n))), ey), ex) Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma 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=Base/base.bend&name=U32.shr https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/model.bend&name=Balanced https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/refinement.bend&name=Swap https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/refinement.bend&name=swap_high https://jend.leeeet.dev/definition.txt?path=bendtorch-core@0.1.0.0/src/storage/refinement.bend&name=swap_low