Immutables

Immutables implements several immutable, or persistent, data structures for R: operations return modified copies while remaining fast and true to R's side-effect-free functional nature with list-like semantics.

Speed and Flexibility

Backed by monoid-annotated finger trees as described by Hinze and Paterson, most operations are constant time, amortized constant time, or $O(\log(n))$. Core functions are implemented in C++ (via Rcpp) for speed, with matching pure-R reference implementations that follow the structure and type signatures of the paper's Haskell.

The developer API supports the addition of custom structures via combinations of monoids and measures. See the full documentation for vignettes and reference, including a gallery of worked examples and benchmarks.