def replace

bend-collections@1.0.0.0 · src/containers/binary_heap.bend:394

import bend-collections@1.0.0.0/src/containers/binary_heap.bend as BinaryHeap
import Base
import bend-collections@1.0.0.0/src/containers/types/binary_heap.bend as E

394# FromList replaces the heap: the old block is dropped (O(1) erasure).
395def replace(~A: Data, ~cmp: A -> A -> Cmp, h: Heap<A>, xs: List<&2, A>) -> Heap<A> & E.Obs<A>:
396  BH{size, n, depth, cap, arr} = h
397  (from_list(~A, ~cmp, xs), E.OUnit{})

Uses (7)

Used by (1)