Implementing Persistent O(1) Stacks and Queues in R
Shawn T. O’Neil
, The R Journal (2015) 7:1, pages 118-126.
Abstract True to their functional roots, most R functions are side-effect-free, and users expect datatypes to be persistent. However, these semantics complicate the creation of efficient and dynamic data structures. Here, we describe the implementation of stack and queue data structures satisfying these conditions in R, available in the CRAN package rstackdeque. Guided by important work in purely functional languages, we look at both partiallyand fully-persistent versions of queues, comparing their performance characteristics. Finally, we illustrate the usefulness of such dynamic structures with examples of generating and solving mazes.
Received: 2014-12-16; online 2015-06-24@article{RJ-2015-009, author = {Shawn T. O’Neil}, title = {{Implementing Persistent O(1) Stacks and Queues in R}}, year = {2015}, journal = {{The R Journal}}, doi = {10.32614/RJ-2015-009}, url = {https://doi.org/10.32614/RJ-2015-009}, pages = {118--126}, volume = {7}, number = {1} }