p()

Here’s how to use p() function.

A .p()

Description:

Get ordinal numbers of the members at specified positions.

Syntax:

A.p(i)

-n£i£n; 1<=i<=n indicates getting the ordinal number of the ith member; -n<=i<=-1 indicates getting the ordinal number of the ith member backwards.

A.p(P)

P is the n-integer sequence whose length is m. Its members should be greater than -n and less than n, but they should not be equal to 0.

Note:

A is a sequence whose length is n, from which you get ordinal numbers of the members at specified positions. The function is generally used to get the ordinal numbers of the members reversely.

Parameter:

A

A sequence object whose length is n

i

An integer

P

An n-integer sequence whose length is m

Option:

@r

Turn back if the specified position exceeds the boundary of A, that is, if the integer i that exceeds the limit of sequence A can be fully divided by n, i is equal to n; otherwise, i is equal to the remainder of i divided by n; n is the length of A.

@0

The member represented by an ordinal number exceeding the boundary of A will be excluded from the result of A.p(P).

Return value:

Integer/Integer sequence

Example:

 

A

 

1

[a,b,c,d,e,f,g,h,i,j]

 

2

=A1.p(2)

2

3

=A1.p(-2)

9

4

=A1.p([2,3])

[2,3]

5

=A1.p([-2,-3])

[9,8]

6

=A1.p@0([5,12])

[5]

7

=A1.p@r([5,12])

[5,2]

Related function:

A.m()