Description Usage Arguments Details Value References Examples
View source: R/insert_back.rpqueue.R
Returns a version of the queue with the new element in the back position.
1 2 | ## S3 method for class 'rpqueue'
insert_back(x, e, ...)
|
x |
rpqueue to insert onto. |
e |
element to insert. |
... |
additional arguments to be passed to or from methods (ignored). |
Runs in O(1) time worst-case. Does not modify the original.
modified version of the rpqueue.
Okasaki, Chris. Purely Functional Data Structures. Cambridge University Press, 1999.
1 2 3 4 5 6 7 8 | q <- rpqueue()
q <- insert_back(q, "a")
q <- insert_back(q, "b")
print(q)
q2 <- insert_back(q, "c")
print(q2)
print(q)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.