~/bend-docscommunity

src/containers/internal/vec.bend checks

raw source on the hub · import bend-collections-laws-containers@1.0.0.0/src/containers/internal/vec.bend as Vec

1 import
import Base

Types

type Vec source · line 10 · raw

@-T:Data -> Data

Definitions

def pow2 source · line 14 · raw

@k:Nat -> Nat

def dec source · line 22 · raw

@d:Nat -> @+j:Nat -> Bool

Branch decision at a node of depth d for slot j: True = lower half.

def get_go source · line 29 · raw

@-T:Data -> @d:Nat -> @t:Vec<T> -> @+j:Nat -> @left:Bool -> Maybe<&2, T>

def get source · line 43 · raw

@-T:Data -> @+d:Nat -> @t:Vec<T> -> @+j:Nat -> Maybe<&2, T>

Slot j of a depth-d vector (None only for a malformed tree).

def set_go source · line 46 · raw

@-T:Data -> @d:Nat -> @t:Vec<T> -> @+j:Nat -> @+v:T -> @left:Bool -> Vec<T>

def set source · line 60 · raw

@-T:Data -> @+d:Nat -> @t:Vec<T> -> @+j:Nat -> @+v:T -> Vec<T>

Replace slot j (j < 2^d).

def depth_go source · line 65 · raw

@n:Nat -> @+d:Nat -> @room:Nat -> Nat

Smallest depth whose capacity covers n more slots: room counts the free slots left at the current depth (capacity 2^d).

def depth_for source · line 74 · raw

@n:Nat -> Nat