A .diff( x )

Read(187) Label: first, remove, difference,

Description:

Calculate difference between the sequence-type members in a specified sequence to generate a new sequence where the first subsequence won’t contain members that exist in the other sub-sequences.

Syntax:

A.diff(x)

Note:

Generally sequence A contains multiple sub-sequences. The function loops through each sub-sequence of A to compute expression x and get the difference between these sub-sequences, ensuring that the difference result doesn’t include any member of the other sub-sequences.

The algorithm is to compute the difference between the first sub-sequence and the second one, then compute the difference between the result and the third sub-sequence, and so on and so forth.

Parameters:

A

A sequence whose members are 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].diff(~.(NAME))

Remove only one of the duplicate members

Related functions:

A.diff()