combine: combine

Description Usage Arguments Details Value Examples

View source: R/combine.r

Description

Combine two objects (queue/stack/deque) into one of the same type.

Usage

1
combine(x1, x2)

Arguments

x1, x2

Two different deques, stacks, or queues. Arguments must be of the same type.

Details

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

Value

Returns NULL. After combining, object x2 is a 0-length (empty) object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
library(dequer)
s1 <- stack()
for (i in 1:5) push(s1, i)
s2 <- stack()
for (i in 10:8) push(s2, i)

combine(s1, s2)
s1 # now holds all 8 elements
s2 # holds 0 elements

## End(Not run)

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