Skip to contents

Add elements to left side of Deque objects.

Usage

addleft(.x, ...)

ref_addleft(.x, ...)

# S3 method for class 'Deque'
addleft(.x, ...)

# S3 method for class 'Deque'
ref_addleft(.x, ...)

Arguments

.x

a [Deque] object

...

elements to be added.

Value

For Deque, an object of class Deque with the elements being added to the left of .x.

Note

While addleft uses copy semantics ref_addleft work by reference.

Examples

d = deque(0)
add(d, a = 1, b = 2)         # |0, a = 1, b = 2|
#> |0, a = 1, b = 2|
addleft(d, a = 1, b = 2)     # |b = 2, a = 1, 0|
#> |b = 2, a = 1, 0|