without_front.rpqueue: Return a version of an rpqueue without the front element

Description Usage Arguments Details Value References See Also Examples

View source: R/without_front.rpqueue.R

Description

Simply returns a version of the given rpqueue without the front element. Results in an error if the structure is empty. The original rpqueue is left alone.

Usage

1
2
## S3 method for class 'rpqueue'
without_front(x, ...)

Arguments

x

rpqueue to remove elements from.

...

additional arguments to be passed to or from methods (ignored).

Details

Runs in O(1) worst case time.

Value

version of the rpqueue with the front element removed.

References

Okasaki, Chris. Purely Functional Data Structures. Cambridge University Press, 1999.

See Also

peek_front for accessing the front element.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
q <- rpqueue()
q <- insert_back(q, "a")
q <- insert_back(q, "b")
q <- insert_back(q, "c")

q2 <- without_front(q)
print(q2)

q3 <- without_front(q)
print(q3)

print(q)

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