-
Notifications
You must be signed in to change notification settings - Fork 5
rotate$
Subhajit Sahu edited this page Mar 15, 2020
·
25 revisions
Copies part of array to another.
array.rotate$(x, y, [j], [i], [I]);
// x: target array (updated)
// y: source array
// j: write index (0)
// i: read start index (0)
// I: read end index (x.length)
// --> x
const array = require('extra-array');
var a = [1, 2, 3, 4, 5];
var b = [10, 20, 30];
array.rotate$(a, b);
// [10, 20, 30, 4, 5]
a;
// [10, 20, 30, 4, 5]
var a = [1, 2, 3, 4, 5];
array.rotate$(a, b, 1);
// [1, 10, 20, 30, 5]
var a = [1, 2, 3, 4, 5];
array.rotate$(a, b, 1, 1);
// [1, 20, 30, 4, 5]
var a = [1, 2, 3, 4, 5];
array.rotate$(a, b, 1, 1, 2);
// [1, 20, 3, 4, 5]