Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

push

Operations on Stacks/Queues


Description

Functions for interacting with stack and queue data structures implemented using filehash databases.

Usage

push(db, val, ...)
mpush(db, vals, ...)
pop(db, ...)
top(db, ...)
isEmpty(db, ...)

Arguments

db

an object of class "stack" or "queue"

val

an R object

vals

a list of R objects

...

arguments passed to other methods

Details

Note that for mpush, if vals is not a list it will be coerced to a list via as.list. Currently, mpush is only implemented for "stack"s.

Value

push and mpush return nothing useful; pop returns a value from the stack/queue and deletes that value from the stack/queue; top returns the "top" value from the stack/queue; isEmpty returns TRUE/FALSE depending on whether the stack/queue is empty or not. Both pop and top signal an error if the stack/queue is empty.

Author(s)

Roger D. Peng rpeng@jhsph.edu


filehash

Simple Key-Value Database

v2.4-2
GPL (>= 2)
Authors
Roger D. Peng <rdpeng@jhu.edu>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.