Learn R Programming

dequer (version 2.0-2)

popping: pop/popback

Description

Remove items from the front of a stack, queue, or deque for pop(); or, remove items from the back of a deque for popback().

Usage

pop(x)

# S3 method for deque pop(x)

# S3 method for queue pop(x)

# S3 method for stack pop(x)

popback(x)

# S3 method for deque popback(x)

Arguments

x

A queue, stack, or deque.

Value

Returns NULL; deletion operates via side-effects.

Details

Operates via side-effects; see examples for clarification on usage.

Examples

Run this code
# NOT RUN {
library(dequer)

### A simple queue example
q <- queue()
for (i in 1:3) pushback(q, i)

pop(q)
str(q)

### A simple stack example
s <- stack()
for (i in 1:3) push(s, i)
pop(s)
str(s)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab