Learn R Programming

collections (version 0.2.5)

StackL: StackL (R implementation)

Description

The StackL function creates a stack. Pure R implementation for benchmarking.

Usage

StackL(items = NULL)

Arguments

items

a list of items

Details

Following methods are exposed:

.$push(item)
.$pop()
.$peek()
.$clear()
.$size()
.$as_list()
.$print()
  • item: any R object

See Also

Stack

Examples

Run this code
# NOT RUN {
s <- StackL()
s$push("first")
s$push("second")
s$pop()  # second
s$pop()  # first

s <- StackL(list("foo", "bar"))
s$push("baz")$push("bla")
# }

Run the code above in your browser using DataLab