Stack {collections}R Documentation

Stack

Description

The Stack function creates a stack.

Usage

Stack(items = NULL)

Arguments

items

a list of items

Details

Following methods are exposed:

.$push(item)
.$pop()
.$peek()
.$clear()
.$size()
.$as_list()
.$print()

See Also

StackL

Examples

s <- Stack()
s$push("first")
s$push("second")
s$pop()  # second
s$pop()  # first

s <- Stack(list("foo", "bar"))
s$push("baz")$push("bla")

[Package collections version 0.2.2 Index]