ROTATE numberOfPlaces inputVector resultVariable

Rotates the elements of inputVector the given number of places to the right or left and puts the result in resultVariable. If numberOfPlaces is positive, the rotation will be to the right. If it is negative, the rotation will be to the left. If numberOfPlaces is zero, the vector will not be rotated.

InputVector itself is left unchanged.

See also: SHIFT

The following program illustrates the operation of the ROTATE command.

COPY 1,10 v
ROTATE  4 v vRight4
ROTATE -4 v vLeft4
PRINT v vRight4 vLeft4

Here is the output of the above program:

v: (1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0)
vRight4: (7.0 8.0 9.0 10.0 1.0 2.0 3.0 4.0 5.0 6.0)
vLeft4: (5.0 6.0 7.0 8.0 9.0 10.0 1.0 2.0 3.0 4.0)