Skip to contents

Flexible Sequence (flexseq)

General-purpose persistent sequence with O(1) amortized push/pop at both ends, O(log n) indexing and replacement, and efficient split/concat.

flexseq()
Construct a Persistent Flexible Sequence
as_flexseq()
Coerce to a Persistent Flexible Sequence
push_front()
Push an element to the front
push_back()
Push an element to the back
insert_at()
Insert elements at a position
pop_front()
Pop the front element
pop_back()
Pop the back element
peek_front()
Peek at the front element
peek_back()
Peek at the back element
peek_at()
Peek at an element by position
pop_at()
Pop an element by position
split_at()
Split by Scalar Index or Name
c(<flexseq>)
Concatenate Sequences
`$`(<flexseq>) `$<-`(<flexseq>) `[`(<flexseq>) `[[`(<flexseq>) `[<-`(<flexseq>) `[[<-`(<flexseq>)
Flexseq Indexing
print(<flexseq>)
Print a flexseq
length(<flexseq>)
Sequence Length
as.list(<flexseq>)
Coerce a Sequence to Base List
fapply(<flexseq>)
Apply a function over flexseq elements
plot(<flexseq>)
Plot a Sequence Tree

Priority Queue

Persistent priority queue with O(log n) insert and min/max peek/pop. Name-based read indexing only; cast with as_flexseq() for full sequence operations.

priority_queue()
Construct a Priority Queue
as_priority_queue()
Build a Priority Queue from elements and priorities
insert(<priority_queue>)
Insert an element into a priority queue
peek_min()
Peek minimum-priority element
peek_max()
Peek maximum-priority element
pop_min()
Pop minimum-priority element
pop_max()
Pop maximum-priority element
`[`(<priority_queue>) `[[`(<priority_queue>) `[<-`(<priority_queue>) `[[<-`(<priority_queue>)
Index a priority queue by name
print(<priority_queue>)
Print a Priority Queue
length(<priority_queue>)
Priority Queue Length
fapply(<priority_queue>)
Apply a function over priority queue entries
plot(<priority_queue>)
Plot a Priority Queue Tree

Ordered Sequence

Persistent key-ordered sequence with O(log n) insert, key lookup, and range queries. Read indexing preserves key order; replacement indexing is not supported.

ordered_sequence()
Construct an Ordered Sequence
as_ordered_sequence()
Build an Ordered Sequence from elements
insert(<ordered_sequence>)
Insert an element into an ordered sequence
peek_key()
Peek elements for one key
pop_key()
Pop elements for one key
lower_bound()
Find first element with key >= value
upper_bound()
Find first element with key > value
elements_between()
Return elements in a key range
count_key()
Count elements matching one key
count_between()
Count elements in a key range
`[`(<ordered_sequence>) `[[`(<ordered_sequence>) `[<-`(<ordered_sequence>) `[[<-`(<ordered_sequence>)
Index an ordered sequence
print(<ordered_sequence>)
Print an ordered sequence summary
length(<ordered_sequence>)
Ordered Sequence Length
as.list(<ordered_sequence>)
Coerce Ordered Sequence to List
fapply(<ordered_sequence>)
Apply a function over ordered sequence entries
plot(<ordered_sequence>)
Plot an Ordered Sequence Tree

Interval Index

Persistent interval index with O(log n) insertion and immutable interval query/pop helpers over ordered interval endpoints.

interval_index()
Construct an Interval Index
as_interval_index()
Build an Interval Index from elements and interval bounds
insert(<interval_index>)
Insert an element into an interval index
peek_point()
Peek intervals containing a point
pop_point()
Pop intervals containing a point
peek_overlaps()
Peek intervals overlapping a query interval
peek_containing()
Peek intervals containing a query interval
peek_within()
Peek intervals within a query interval
pop_overlaps()
Pop overlapping intervals
pop_containing()
Pop intervals containing a query interval
pop_within()
Pop intervals within a query interval
interval_bounds()
Get interval bounds in sequence order
`$`(<interval_index>) `$<-`(<interval_index>) `[`(<interval_index>) `[[`(<interval_index>) `[<-`(<interval_index>) `[[<-`(<interval_index>)
Index an interval index
print(<interval_index>)
Print an interval index summary
length(<interval_index>)
Interval Index Length
as.list(<interval_index>)
Coerce Interval Index to List
fapply(<interval_index>)
Apply a function over interval index entries
plot(<interval_index>)
Plot an Interval Index Tree

Developer Tools

Lower-level primitives for custom monoids, predicate queries, and validation.

insert()
Insert an element
fapply()
Fapply with S3 dispatch
add_monoids()
Add/merge monoids on an existing tree
locate_by_predicate()
Locate First Predicate Flip Without Reconstructing Context Trees
split_around_by_predicate()
Split Around First Predicate Flip
split_by_predicate()
Split a flexseq into Left and Right Parts by Predicate
measure_monoid()
Construct a Measure Monoid Specification
predicate()
Construct a Predicate Function
validate_tree()
Validate full tree invariants (debug/test utility)
validate_name_state()
Validate name-state invariants only (debug/test utility)