deque {collections}R Documentation

Double Ended Queue

Description

deque creates a double ended queue.

Usage

deque(items = NULL)

Arguments

items

a list of items

Details

Following methods are exposed:

.$push(item)
.$pushleft(item)
.$pop()
.$popleft()
.$peek()
.$peekleft()
.$extend(q)
.$extendleft(q)
.$remove(item)
.$clear()
.$size()
.$as_list()
.$print()

See Also

queue and stack

Examples

q <- deque()
q$push("foo")
q$push("bar")
q$pushleft("baz")
q$pop()  # bar
q$popleft()  # baz

q <- deque(list("foo", "bar"))
q$push("baz")$pushleft("bla")

[Package collections version 0.3.5 Index]