Learn R Programming

flifo (version 0.1.5)

pop: Retrieve an object from a stack

Description

The pop function retrieves the first reachable object from .stack.

Usage

pop(.stack)

Arguments

.stack

A stack.

Value

The object retrieved. If .stack is empty, an error is thrown.

Details

The pop function is not pure. Side effect is that .stack is modified in the calling environment.

See Also

push.

Examples

Run this code
# NOT RUN {
(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

# }

Run the code above in your browser using DataLab