Skip to contents

rev provides a reversed version of its argument.

Usage

ref_rev(x)

# S3 method for class 'Deque'
ref_rev(x)

# S3 method for class 'Deque'
rev(x)

Arguments

x

Deque object

Value

For Deque, an object of class Deque

Details

rev uses copy semantics while ref_rev works by reference, that is, it reverse all elements in place.

See also

Examples


d = deque(a = 1, b = 2, 3)
rev(d)
#> |3, b = 2, a = 1|
print(d)
#> |a = 1, b = 2, 3|
ref_rev(d)
#> |3, b = 2, a = 1|
print(d)
#> |3, b = 2, a = 1|