def Heap.pop

bend-kit-collections@0.1.4.1 · heap.bend:68

import bend-kit-collections@0.1.4.1/heap.bend as Heap
import Base

68# the top, and the heap without it; None on an empty heap
69def Heap.pop(
70  ~A: Data, ~le: A -> A -> Bool, h: Heap<A>
71) -> Maybe<&1, A & Heap<A>>:
72  match h:
73    case HLeaf{}:
74      None{}
75    case HNode{n, x, l, r}:
76      Some{(x, Heap.merge(~A, ~le, l, r))}

Uses (6)

Used by (1)