~/bend-docscommunity

lib.bend checks

raw source on the hub · import 0x36850d3ea56845a044f30fd80ec1da6c/lib.bend as Lib

Prio — foundational U32 priority bag for Bend. Publish entry for this package. Depends only on Base.

This v1 intentionally ships a sorted priority bag rather than a binary heap. The representation is a sorted List, so push is O(n), while peek_min and pop_min are O(1) at the front. The API is heap-shaped and can be upgraded to a binary-heap representation later without changing callers.

1 import
import Base

Types

type Prio source · line 10 · raw

Data

type Prio.Pop source · line 13 · raw

Data

Definitions

def Prio.insert.go source · line 17 · raw

@+xs:List<&2, U32> -> @+x:U32 -> List<&2, U32>

Insert while preserving nondecreasing U32 order.

def Prio.insert source · line 25 · raw

@xs:List<&2, U32> -> @+x:U32 -> List<&2, U32>

def Prio.empty source · line 28 · raw

Prio

def Prio.push source · line 31 · raw

@q:Prio -> @x:U32 -> Prio

def Prio.peek_min source · line 36 · raw

@q:Prio -> Maybe<&2, U32>

def Prio.pop_min.go source · line 45 · raw

@xs:List<&2, U32> -> Maybe<&2, Prio.Pop>

def Prio.pop_min source · line 52 · raw

@q:Prio -> Maybe<&2, Prio.Pop>

def Prio.size source · line 57 · raw

@q:Prio -> Nat

def Prio.is_empty source · line 62 · raw

@q:Prio -> Bool

def Prio.to_list source · line 67 · raw

@q:Prio -> List<&2, U32>

def Prio.from_list.go source · line 72 · raw

@xs:List<&2, U32> -> @q:Prio -> Prio

def Prio.from_list source · line 79 · raw

@xs:List<&2, U32> -> Prio