Creates a generator that rotates elements in an iterable by n positions. Positive values rotate forward, negative values rotate backward.
Element type
Number of positions to rotate (positive for forward, negative for backward)
If n is not a safe integer
Elements from the input iterable rotated by n positions
G.pipe( G.range(1, 5), G.rotate(2), G.array) // [3, 4, 5, 1, 2] Copy
G.pipe( G.range(1, 5), G.rotate(2), G.array) // [3, 4, 5, 1, 2]
Creates a generator that rotates elements in an iterable by n positions. Positive values rotate forward, negative values rotate backward.