flexseq: Construct a Persistent Flexible Sequence

View source: R/30-api-flexseq-core.R

flexseqR Documentation

Construct a Persistent Flexible Sequence

Description

flexseq(...) creates an immutable sequence from ..., preserving element order and optional names, with efficient persistent updates.

Usage

flexseq(...)

Arguments

...

Sequence elements.

Details

It is list-like in payload flexibility (any R object per element), but sequence-oriented in API (⁠push_*⁠, ⁠peek_*⁠, ⁠pop_*⁠, indexing, split/concat).

flexseq is the base general-purpose structure in this package. Specialized structures such as priority_queue, ordered_sequence, and interval_index build on related internals but expose narrower semantics.

flexseq operations are persistent: updates return new objects and do not mutate prior versions.

Value

A flexseq object.

See Also

as_flexseq(), priority_queue(), ordered_sequence(), interval_index()

Examples

x <- flexseq(1, 2, 3)
x

y <- push_front(x, 0)
y
x  # unchanged

named <- flexseq(a = 1, b = 2)
named
named[["a"]]

Immutables documentation built on April 29, 2026, 1:06 a.m.