Module collections
SourceDescription
Collection trait hierarchy and generic collection helpers.
Declares the abstract-collection traits (Foldable, Mappable, Filterable, Keyed, Chainable, Indexed, Zippable) and the category aliases (Seq, Map, Set) that classify concrete types like Vec, HashMap, and HashSet.
Modules
- binaryheap
BinaryHeap — max-heap priority queue.
- btreemap
BTreeMap — ordered key-value collection.
- btreeset
BTreeSet — ordered set of unique elements keyed by
(Ord elem elem).- hashmap
HashMap — hash-based key-value collection.
- hashset
HashSet — hash-based unique-element set.
- linkedlist
LinkedList — doubly-linked list with O(1) push/pop at both ends.
- vecdeque
VecDeque — double-ended queue with O(1) push/pop at both ends.
Data Types
Records
- HashState
Opaque, seeded hasher state used internally by
HashMapandHashSet
Abstractions
Traits
- Chainable
Trait for collections that can be concatenated end-to-end.
- Filterable
Trait for collections that support element selection by predicate.
- Foldable
Trait for collections whose elements can be consumed by folding.
- Indexed
Trait for collections with positional access by integer index.
- Keyed
Trait for collections that support key-indexed access.
- Map
Key-value-collection alias — any keyed, foldable type.
- Mappable
Trait for collections whose elements can be transformed element-wise.
- Seq
Sequential-collection alias — any type that is foldable, mappable,
- Set
Unique-element collection trait.
- Zippable
Trait for collections that can be combined element-wise.
Functions
Functions
- hash-state-new
Construct a
HashStatewith a fixed zero seed.- product-int
Multiply the elements of a
Foldablecollection of AnyInt values.- sum-int
Sum the elements of a
Foldablecollection of AnyInt values.- while
Classic while-loop word: repeatedly evaluate
cond; while it yields
Trait Implementations
impl Default for HashMap(?540301 ?540302)
HashMap's .default MUST draw a seeded HashState via (HashState .new), carrying +Random. The HashState is produced and dropped here because hashmap-new-intrinsic does not yet accept a state argument (the runtime HashMap does not thread the seed through its bucket hasher). The declared +Random effect is still load-bearing: it documents that HashMap construction is non-deterministic per the HashDoS-resistance contract and forces callers to either sit inside a +Random handler or use an explicit zero-seed path through hash-state-new + hashmap-new-intrinsic.
impl Foldable for HashMap(?540484 ?540485)
impl Keyed for HashMap(?540803 ?540804)
impl Default for HashSet(?540305)
HashSet's .default mirrors HashMap's: draws (HashState .new) and discards the state, carrying +Random.
impl Foldable for HashSet(?540606)
impl Foldable for ?540661..?540662
impl Chainable for Vec(?540812 ?540813)
impl Filterable for Vec(?540792 ?540793) | Vec(?540792 ?540793)
impl Foldable for Vec(?540398 ?540399)
.chunks-n ( (Vec elem) (Int ..) → (Vec (Vec elem)) )
.chunks-n ( (Vec elem) (Int ..) → (Vec (Vec elem)) )
Vec-specific chunks-n: Pair(completed_chunks, current_chunk) accumulator; finaliser flushes any non-empty trailing chunk.
.flat-map ( (Vec elem) [elem → (Vec b) ] → (Vec b) )
.flat-map ( (Vec elem) [elem → (Vec b) ] → (Vec b) )
Vec-specific flat-map: call f per element, flatten the results.