-
Notifications
You must be signed in to change notification settings - Fork 1
rotate
wolfram77 edited this page Mar 27, 2020
·
19 revisions
Rotates values in iterable.
iterable.rotate(x, n);
// x: an iterable
// n: rotate amount (-ve: left, +ve: right)
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4];
iterable.rotate(x, 1);
// [4, 1, 2, 3]
iterable.rotate(x, 2);
// [3, 4, 1, 2]
iterable.rotate(x, -1);
// [2, 3, 4, 1]