BinaryHeap.drain_take_go: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/containers/binary_heap.bend as BinaryHeap Lines 345-353 of bend-collections@1.0.0.0/src/containers/binary_heap.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&start_line=345&end_line=353 import Base # Take the root out of a copy holding `n` elements. Emptiness is decided by # the count, not by reading slot 0: the drain must stop at `n = 0` whatever # the slots above the heap hold (and it saves one array read per element). def drain_take_go(~A: Data, +n: U32, arr: Array>, empty: Bool) -> Drain: match empty: case True{}: DrDone{arr} case False{}: drain_take(~A, U32.sub(n, 1), Array.get(Maybe<&2, A>, arr, 0)) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Array.get 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=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=Drain https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=drain_take