Learn R Programming

dequer (version 2.0-2)

combine: combine

Description

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

Usage

combine(x1, x2)

Arguments

x1, x2

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

Value

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

Details

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

Examples

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

Run the code above in your browser using DataLab