Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Fully qualified name: Std.Arrays.CircularlyShifted
function CircularlyShifted<'T>(stepCount : Int, array : 'T[]) : 'T[]
Shift an array circularly left or right by a specific step size.
The type of the array elements.
The amount of positions by which the array elements will be shifted.
If this is positive, array
is circularly shifted to the right.
If this is negative, array
is circularly shifted to the left.
Array to be circularly shifted.
An array output
that is the array
circularly shifted to the right or left
by the specified step size.
let array = [10, 11, 12];
// The following line returns [11, 12, 10].
let output = CircularlyShifted(2, array);
// The following line returns [12, 10, 11].
let output = CircularlyShifted(-2, array);