icount()

Read(2301) Label: sequence, count, distinct,

Description:

Count the number of distinct members in a sequence.

Syntax:

A.icount(x)

 

icount(x1,…,xn)

Equivalent to A.icount(), where x1,…,xn are members of sequence A; do not support working with options

Note:

The function calculates the number of distinct members in sequence A.

Parameter:

A

A sequence

x

An expression; cannot be omitted when A is a table sequence or a record sequence

Option:

@o

Assume sequence A is ordered and only remove duplicates by comparing neighboring members

@n

Judge whether a member is distinct or not according to position when parameter A is a number sequence

@b

Judge whether a member is distinct or not according to the long type bit when parameter A is a number sequence

Return value:

Integer

Example:

When A is a sequence:

 

A

 

1

=["a","c","d","e","f","a","a"]

 

2

=A1.icount()

5

3

=[1,4,9,16,25,36,49,64,81,100,81]

An integer sequence.

4

=A3.icount@n()

10; judge whether a member is distinct or not according to the position.

5

=A3.icount@b()

10; judge whether a member is distinct or not according to the long type bit.

6

=icount("a","c","d","e","f","a","a")

5, which is same as A2.

When A is a table sequence or a record sequence:

 

A

 

1

=demo.query("select EID,NAME,GENDER,DEPT from EMPLOYEE") .sort(DEPT)

Return a table sequence ordered by DEPT.

2

=A1.icount@o(DEPT)

Find number of departments in the EMPLOYEE table.