pushing: push/pushback

Description Usage Arguments Details Value Examples

Description

Add items to the front of a stack or deque via pop(). Add items to the back of a queue or deque via popback().

Usage

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

## S3 method for class 'deque'
push(x, data)

## S3 method for class 'stack'
push(x, data)

pushback(x, data)

## S3 method for class 'deque'
pushback(x, data)

## S3 method for class 'queue'
pushback(x, data)

Arguments

x

A queue, stack, or deque.

data

R object to insert at the front of the deque/stack.

Details

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

Value

Returns NULL; insertion operates via side-effects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(dequer)

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

str(q)

### A simple stack example
s <- stack()
for (i in 1:3) push(s, i)

str(s)

## End(Not run)

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