length.rdeque: Return the number of elements in an rdeque

Description Usage Arguments Details Value See Also Examples

View source: R/length.rdeque.R

Description

Returns the number of elements in an rdeque.

Usage

1
2
## S3 method for class 'rdeque'
length(x)

Arguments

x

rdeque to get the length of.

Details

Runs in O(1) time, as this information is stored seperately and updated on every insert/remove.

Value

a vector of length 1 with the number of elements.

See Also

empty for checking whether an rdeque is empty.

Examples

1
2
3
4
5
d <- rdeque()
d <- insert_front(d, "a")
print(length(d))         # 1
d <- insert_back(d, "b")
print(length(d))         # 2

rstackdeque documentation built on May 29, 2017, 5:34 p.m.

Search within the rstackdeque package
Search all R packages, documentation and source code