popping: pop/popback

Description Usage Arguments Details Value Examples

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
pop(x)

## S3 method for class 'deque'
pop(x)

## S3 method for class 'queue'
pop(x)

## S3 method for class 'stack'
pop(x)

popback(x)

## S3 method for class 'deque'
popback(x)

Arguments

x

A queue, stack, or deque.

Details

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

Value

Returns NULL; deletion operates via side-effects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

## End(Not run)

dequer documentation built on May 1, 2019, 11:30 p.m.