Statistics, Department of

 

The R Journal

Date of this Version

6-2015

Document Type

Article

Citation

The R Journal (June 2015) 7(1); Editor: Bettina Grün

Comments

Copyright 2015, The R Foundation. Open access material. License: CC BY 3.0 Unported

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 partially- and 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.

Share

COinS