step()

Here’s how to use step() function.

A.step()

Description:

Create a sequence by getting members from a sequence according to the specified starting position and a step.

Syntax:

A.step(m,ki,…)

Note:

The function finds the members whose sequence numbers are ki, ki+m, ki+2m,…from A to compose a new sequence.

Parameters:

m

A positive integer used to specify the step

ki

The starting sequence number, 1<=ki. The default is 1 

A

A sequence whose length is n

Return value:

A new sequence whose length is m

Example:

 

A

 

1

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

 

2

=A1.step(2,1)

[1,3,5,7,9] Get members at the odd positions.

3

=A1.step(3,1,2)

[1,2,4,5,7,8,10] Get two every other one.

4

=A1.step(2)

Start from the first member when ki,… is absent