isect()

Read(802) Label: isect,

Here’s how to use isect() function.

A .isect()

Description:

Compute the intersection of all sequence-type members in a sequence.

Syntax:

A.isect()

Note:

Members of sequence A are also sequences. The function creates a new sequence composed of all common members of the sub-sequences.

Parameter:

A

A sequence whose members are also sequences.

Return value:

A sequence

Example:

 

A

 

1

=[[1,2,3,4,5],[3,7,8]].isect()

[3]

2

=[[1,2,3],[3,2]].isect()

[2,3]

3

=[[1,2,2,3],[2]].isect()

[2]

4

=demo.query("select top 2 * from EMPLOYEE")

5

=demo.query("select top 1 * from EMPLOYEE")

6

=[A4,A5].isect()

[] Since A4 and A5 come from different table sequences and have different store addresses, so same records are regarded as different members

Related function:

A.union()

A.diff()

A.conj()

A.xunion()

A .isect( x )

Description:

Compute x with each member of the sequence whose members are sequences, and then perform intersection operation between members of the new sequence.

Syntax:

A.isect(x)

Note:

Members of sequence A are also sequences. The function loops through members of sequence A to compute expression x and creates a sequence composed of all common members of the new sub-sequences.

Parameter:

A

A sequence whose members are also sequences

x

An expression that returns a sequence

Return value:

A sequence

Example:

 

A

 

1

=demo.query("select * from EMPLOYEE where GENDER = 'M' order by NAME")

 

2

=demo.query("select * from EMPLOYEE where GENDER = 'F' order by NAME")

 

3

=[A1,A2].isect(~.(NAME))

Intersection operation between A1 and A2

Related function:

A.isect()