def pop_move

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

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

248# The last element has been taken out of slot m = n - 1; put it at the root
249# and sift it down over the remaining m elements.
250def pop_move(~A: Data, ~cmp: A -> A -> Cmp, size: Nat, +m: U32, +depth: Nat, cap: U32, root: A, last: A, arr: Array<Maybe<&2, A>>, empty: Bool) -> Heap<A> & Result<&2, &2, E.Error, A>:
251  match empty:
252    case True{}:
253      (BH{size, m, depth, cap, arr}, Done{root})
254    case False{}:
255      (BH{size, m, depth, cap, sift_down(~A, ~cmp, depth, m, 0, last, arr)}, Done{root})

Uses (12)

Used by (1)