Rotate all elements n
steps to the right. If n is
negative, rotate to the left.
Usage
rotate(x, n = 1L)
ref_rotate(x, n = 1L)
# S3 method for class 'Deque'
rotate(x, n = 1L)
# S3 method for class 'Deque'
ref_rotate(x, n = 1L)
Value
For Deque
returns the rotated Deque()
object.
Details
While rotate
uses copy semantics, ref_rotate
works by reference,
that is, rotates in place on the original object.
Examples
d = deque(1, 2, 3, 4)
rotate(d)
#> |4, 1, 2, 3|
rotate(d, n = 2)
#> |3, 4, 1, 2|