insert_front | R Documentation |
Returns a version of the deque with the new element in the front position.
insert_front(d, e, ...)
d |
rdeque 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 rdeque.
modified version of the rdeque.
Okasaki, Chris. Purely Functional Data Structures. Cambridge University Press, 1999.
without_front
for removing the front element.
d <- rdeque() d <- insert_front(d, "a") d <- insert_front(d, "b") print(d) d2 <- insert_front(d, "c") print(d2) print(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.