A.shift()

Read(799) Label: a shuffled sequence,

Description:

Get a shuffled sequence.

Syntax:

A.shift(i,s)

Note:

The function traverses members of sequence A. During the traversal, if the sequence number of the current member is greater than or equal to parameter i and, at the same time, less than or equal to [A.len()-s], return the sth member after the current one; otherwise, return the current member. A.len() is the length of sequence A. If the sum of i and s is greater than A.len(), the sequence won’t be shuffled.

Parameter:

i

The starting position, which is a positive integer; 1 is the default value

s

The offset value, which is a positive integer; 1 is the default value

Return value:

A sequence

Example:

 

A

 

1

[1,2,3,4,5,6,7,8,9,10]

 

2

=A1.shift(4,3)

3

=to(10).new(~:id,~*~:value)

 

4

=A3.shift(3,2)

Before shifting:

After shifting: