BinaryHeap.step: def of bend-collections@1.0.0.0
Import: import bend-collections@1.0.0.0/src/containers/binary_heap.bend as BinaryHeap
Lines 399-412 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=399&end_line=412
import Base
import bend-collections@1.0.0.0/src/containers/types/binary_heap.bend as E
def step(~A: Data, ~cmp: A -> A -> Cmp, h: Heap, op: E.Op) -> Heap & E.Obs:
match op:
case E.Length{}:
obs_nat(~A, length(~A, h))
case E.Push{x}:
(push(~A, ~cmp, h, x), E.OUnit{})
case E.Peek{}:
obs_item(~A, peek(~A, h))
case E.Pop{}:
obs_item(~A, pop(~A, ~cmp, h))
case E.FromList{xs}:
replace(~A, ~cmp, h, xs)
case E.ToSortedList{}:
obs_list(~A, to_sorted_list(~A, ~cmp, h))
Uses (15):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Cmp
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=Heap
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=length
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=obs_item
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=obs_list
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=obs_nat
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=peek
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=pop
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=push
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=replace
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/binary_heap.bend&name=to_sorted_list
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/types/binary_heap.bend&name=Obs
https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/containers/types/binary_heap.bend&name=Op