push {flifo} | R Documentation |
Insert an object into a stack
Description
The push
function inserts an
object into .stack
.
Usage
push(.stack, x)
Arguments
.stack |
A stack. |
x |
An object to insert in |
Details
The push
function is not pure. Side effects (made on purpose) are:
-
.stack
is modified in the calling environment; -
x
is removed (deleted) if it exists in the calling environment.
Value
NULL
is returned invisibly.
See Also
pop
.
Examples
(s <- lifo(max_length = 3)) # empty LIFO
(push(s, 0.3)) #
(push(s, data.frame(x=1:2, y=2:3)))
obj <- pop(s) # get the last element inserted
[Package flifo version 0.1.5 Index]