DynamicArray.swap_checked_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 680-688 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=680&end_line=688 import Base import bend-collections@1.0.0.0/src/containers/types/dynamic_array.bend as E # Copyable-element exchange, used by indexed collection storage. The previous # value is returned and all other slots remain unchanged. Like set_at, an # invalid index leaves the array unchanged and reports IndexOutOfRange. def swap_checked_at(~T: Data, limit: Nat, depth: Nat, cap: Nat, len: Nat, arr: Array>, i: Nat, v: T, ok: Bool) -> DynArray<&2, T> & Result<&2, &2, E.Error, T>: match ok: case True{}: get_found_at(~T, limit, depth, cap, len, Array.swap(Maybe<&2, T>, arr, U32.from_nat(i), Some{v})) case False{}: (DA{limit, depth, cap, len, arr}, Fail{E.IndexOutOfRange{}}) 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=Array.swap 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=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.from_nat https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/dynamic_array.bend&name=DynArray https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/dynamic_array.bend&name=get_found_at https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/types/dynamic_array.bend&name=Error