DynamicArray.clear_go_at: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/containers/dynamic_array.bend as DynamicArray Lines 423-434 of bend-collections@1.0.0.0/src/containers/dynamic_array.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/containers/dynamic_array.bend&start_line=423&end_line=434 import Base # The executable clear resets the occupied slots [0, length) to None, top # down, and keeps the block: O(length), no allocation. Dropping the old block # and allocating a fresh one (what the parametric `clear` describes) walks # every one of the 2^depth slots twice in the runtime. Every slot at or past # the length already holds None, so the result is the same all-None block; # proofs/containers/dynamic_array/clear.bend proves it on every good state. def clear_go_at(~T: Data, k: Nat, arr: Array>) -> Array>: match k: case 0n: arr case 1n+ +m: clear_go_at(~T, m, Array.set(Maybe<&2, T>, arr, U32.from_nat(m), None{})) Uses (5): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.set 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.from_nat