deque
creates a double ended queue.
deque(items = NULL)
a list of items
Following methods are exposed:
.$push(item)
.$pushleft(item)
.$pop()
.$popleft()
.$peek()
.$peekleft()
.$extend(q)
.$extendleft(q)
.$remove(item)
.$clear()
.$size()
.$as_list()
.$print()
item
: any R object
q
: a deque object
q <- deque()
q$push("foo")
q$push("bar")
q$pushleft("baz")
q$pop() # bar
#> [1] "bar"
q$popleft() # baz
#> [1] "baz"
q <- deque(list("foo", "bar"))
q$push("baz")$pushleft("bla")