Description Usage Arguments Details Value References See Also Examples
View source: R/without_top.rstack.R
Simply returns a version of the given stack without the top element. Results in an error if the structure is empty. The original rstack is left alone.
1 2 | ## S3 method for class 'rstack'
without_top(s, ...)
|
s |
rstack to remove elements from. |
... |
additional arguments to be passed to or from methods (ignored). |
Runs in O(1) time worst case.
version of the stack with the top n elements removed.
Okasaki, Chris. Purely Functional Data Structures. Cambridge University Press, 1999.
insert_top
for inserting elements.
1 2 3 4 5 6 7 8 9 | s <- rstack()
s <- insert_top(s, "a")
s <- insert_top(s, "b")
s <- insert_top(s, "c")
s2 <- without_top(s)
print(s2)
print(s)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.