Tables.Table.set.go: def of bend-lint-api@0.2.0.0 Import: import bend-lint-api@0.2.0.0/shared/tables.bend as Tables Lines 25-68 of bend-lint-api@0.2.0.0/shared/tables.bend: https://jend.leeeet.dev/read.txt?path=bend-lint-api@0.2.0.0/shared/tables.bend&start_line=25&end_line=68 import Base # `t` with `x` numbered `i`: `odd` is whether `i` is, and `zero` whether it is 0. A leaf of another number parts # first. `fuel` bounds the levels: two a bit. def Table.set.go( -A: Data, fuel: Nat, t: Table, +i: U32, x: A, odd: Bool, zero: Bool ) -> Table: match fuel t odd zero: case 0n _ _ _: t case 1n+f TLeaf{v} _ True{}: TLeaf{Some{x}} case 1n+f TLeaf{v} _ False{}: Table.set.go(A, f, TNode{TLeaf{v}, TLeaf{None{}}}, i, x, odd, zero) case 1n+f TNode{e, o} False{} _: TNode{ Table.set.go( A, f, e, U32.shr(i), x, U32.is_eq(U32.and(U32.shr(i), 1), 1), U32.is_zero(U32.shr(i)) ), o } case 1n+f TNode{e, o} True{} _: TNode{ e, Table.set.go( A, f, o, U32.shr(i), x, U32.is_eq(U32.and(U32.shr(i), 1), 1), U32.is_zero(U32.shr(i)) ) } Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_eq https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_zero https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shr https://jend.leeeet.dev/definition.txt?path=bend-lint-api@0.2.0.0/shared/tables.bend&name=Table