Array.swap.go: def of Base Import: import Base Lines 2466-2478 of Base/base.bend: https://jend.leeeet.dev/read.txt?path=Base/base.bend&start_line=2466&end_line=2478 import Base # the recursion descends into a subtree, and z says which: the caller # computes it from the index and the subtree's half size def Array.swap.go(-T: Type, a: Array, n: U32, +i: U32, v: T, z: Bool) -> Array & T: match a z: case ALeaf{x} _: (ALeaf{v}, x) case ANode{xs, ys} True{}: +h = U32.shr(n) Array.swap.lo(T, ys, Array.swap.go(T, xs, h, i, v, U32.is_lt(i, U32.shr(h)))) case ANode{xs, ys} False{}: +h = U32.shr(n) +j = U32.sub(i, h) Array.swap.hi(T, xs, Array.swap.go(T, ys, h, j, v, U32.is_lt(j, U32.shr(h)))) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.swap.hi https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.swap.lo https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair 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