ASPL User Guide v 1.00
© 2025 Bassem W. Jamaleddine


7. 1
   ASPL Set Operations

 

The following are the alignment set operators

f& fU f\ fD fP d& dU d\ dD dP g& gU g\ gD gP

elements intersection

      f& a1 a2 [a3 .. aN]       where a1 a2 [a3 .. aN] are set variables

elements union

      fU a1 a2

elements difference

      f\ a1 a2

elements symmetric difference

      fD a1 a2

elements partition

      fP a1 a2

subgroups intersection

      d& a1 a2

subgroups union

      dU a1 a2

subgroups difference

      d\ a1 a2

subgroups symmetric difference

      dD a1 a2

subgroups partition

      dP a1 a2

group intersection

      g& a1 a2

group union

      gU a1 a2

group difference

      g\ a1 a2

group symmetric difference

      gD a1 a2

group partition

      gP a1 a2

ASPL Set Operations

●  ASPL Set Operations

ASPL provides many set operators to do basic group operations on set variables. The following set operations provide set intersection, union, difference, symmetric difference, and partition on groups: f&, fU, f\, fD, fP, d&, dU, d\, dD, dP, g&, gU, g\, gD, and gP.

For more information on these set operators refer to "ASPL Operations Guide".

 

■ Ticking a Set Operator with a Predicate

The set operators can be catenated with the tick (such that) operator followed by the predicate. The set operators can be ticked with a conditional predicate, hence adding a conditional match based on the attributes of the element or the subgroup. Ticking a set operator is done by catenating the grave symbol followed by a symbol, and this is read as "such that" the predicate is satisfied.

You can list the predicates that a set operator can be ticked (or catenated) with, by either typing at the ASPL prompt tickfor followed by the set operator, or by running the asplsymbols command at the shell prompt. For example, to list the possible predicates that the f& can takes, at the ASPL prompt we type:

aspl> tickfor f&

or at the shell prompt:

asplsymbols -ticksymbol 'f&'

Notice how 'f&' is quoted so that the shell interpreter does not execute the & and throws the job in the background. The above command will print the following on your terminal:
    setop  |suchthat    |phrase                                                                        
    =======|============|================================================================================
1   f&     |f&`_        |gets the elements intersection                                                    
2   f&     |f&`c=       |gets the elements intersection such that they have the same checksum             
3   f&     |f&`c~       |gets the elements intersection such that they have different checksums           
4   f&     |f&`c~~      |gets the elements intersection such that they have all over different checksums 
5   f&     |f&`h=       |gets the elements intersection such that they have the same entropy             
6   f&     |f&`h~       |gets the elements intersection such that they have different entropies          
7   f&     |f&`h~~      |gets the elements intersection such that they have all over different entropies 
8   f&     |f&`mtm=     |gets the elements intersection such that they have the same make time           
9   f&     |f&`mtm~     |gets the elements intersection such that they have different make times          
10  f&     |f&`mtm~~    |gets the elements intersection such that they have all over different make times   
11  f&     |f&`mtm<     |gets the elements intersection such that they have a prior make time            
12  f&     |f&`mtm<=    |gets the elements intersection such that they have prior or same make time     
13  f&     |f&`mtm>     |gets the elements intersection such that they  have more recent make time     
14  f&     |f&`mtm>=    |gets the elements intersection such that they have more recent or same make time 
15  f&     |f&`ks=      |gets the elements intersection such that they have the same ksum             
16  f&     |f&`ks~      |gets the elements intersection such that they have different ksums            
17  f&     |f&`ks~~     |gets the elements intersection such that they have all over different ksums  


The program asplsymbols provides many options to look into ASPL symbols. For instance, the following command display all setops along their tick phrases:

aspl> asplsymbols -tickphrase setops

You may also refer to ASPL Set Operators in ASPL Operations Guide.
Practical usage of these operators can be found in "ASPL by Example" and "ASPL Scripts by Example" of ASPL User Manual.

 

Various Set Operations

The following example shows various set operations performed in the sample namedspace WS1.

The set variables: a1, a2, and a3, represent groups of files and subdirectories captured

on the UNIX system.

 

Various Set Operations

aspl WS1
    (start ASPL loading the WS1 workspace)

①  aspl> f& a1 a2
    display the elements intersection

②  aspl> fU a1 a2
    display the elements union

③  aspl> f\ a1 a2
    display the elements difference between a1 and a2

④  aspl> f\ a2 a1
    display the elements difference between a2 and a1

⑤  aspl> fD a1 a2
    display the symmetric difference of the elements

⑥  aspl> u123 = gU a1 a2 a3
    assign to u123 the the group union of a1 a2 a3

⑦  aspl> v
    view symbol table

⑧  aspl> d& a1 a2
    display the subgroups intersection

⑨  aspl> dU a1 a2
    display the subgroups union

⑩  aspl> d\ a1 a2
    display the subgroups difference between a1 and a2

⑪  aspl> d\ a2 a1
    display the subgroups difference between a2 and a1

⑫  aspl> dD a1 a2
    display the symmetric difference of the subgroups

⑬  aspl> g& a1 a2
    display the groups intersection

⑭  aspl> gU a1 a2
    display the groups union

⑮  aspl> g\ a1 a2
    display the groups difference between a1 and a2

⑯  aspl> g\ a2 a1
    display the groups difference between a2 and a1

⑰  aspl> gD a1 a2
    display the symmetric difference of the groups

⑱  aspl> fP a1 a2
    display the elements partition

⑲  aspl> dP a1 a2
    display the subgroups partition

⑳  aspl> gP a1 a2
    display the groups partition