ASPL Operations Guide v 1.00
© 2025 Bassem W. Jamaleddine


3. 4
   f\ gets the elements difference

 

logo

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

f\`mtm~ a1 a2 [a3 .. aN]

f\/mtm~ a1 a2 [a3 .. aN]

f\

When specified by itself then get the difference of the object on top of stack with the one one below top of stack then push result on the stack

setop  setoid  2*  notcommu        ins:H_H_H  ous:H_H_H

●  Operator f\ gets the elements difference

Use the operator f\ to get the difference between two set variables. If f\ is followed by three or more set variables, then the difference is taken between the first set variable (directly following the operator) and the union of all the rest of the set variables. Use f\ when you want to find all these elements and subgroups that are in a group but not in any other groups.

 

f\ EXAMPLE1

The following example shows how to display the files that exist in the first directory and do not exist in the second directory.

 

f\ OPERATION1

mkdir /tmp/aa1; mkdir /tmp/aa2; mkdir /tmp/aa1/ddd1; mkdir /tmp/aa1/ddd1/ddd11
     create some directories to test with

touch /tmp/aa1/ddd1/foo1; touch /tmp/aa1/ddd1/ddd11/foo111; touch /tmp/aa2/foo111
     create some files

To get the difference between /tmp/aa1 and /tmp/aa2, push /tmp/aa2 first on the stack, then /tmp/aa1

asplcmd 'createworkspace TRANSIENT POSIX; ggdir(dir,/tmp/aa2); ggdir(dir,/tmp/aa1); g\'

To get the difference between /tmp/aa2 and /tmp/aa1, push /tmp/aa1 first on the stack, then /tmp/aa2

asplcmd 'createworkspace TRANSIENT POSIX; ggdir(dir,/tmp/aa1); ggdir(dir,/tmp/aa2); g\'

Alternatively, you can do the operation within ASPL:

aspl -wsname JUNKSPACE -groupingclass POSIX

①  aspl>  ggdir(dir,/tmp/aa2)
     get the group of files in /tmp/aa2 and push on top of stack

②  aspl>  ggdir(dir,/tmp/aa1)
     get the group of files in /tmp/aa1 and push on top of stack

③  aspl>  g\
     get the group difference between the objects on top of stack and one below it

④  aspl>  quit
     exist ASPL without saving the workspace

 

f\ EXAMPLE2
The set difference can be assigned to a set variable. In the following example, we load the namedspace WS1, then issue f\ on two set variables, the result is assigned to a set variable d12.

 

f\ OPERATION2

aspl WS1

①  aspl> d12 = f\ a1 a2
    (d12 is assigned the elements difference between a1 and a2)

②  aspl> display d12
    (print out d12)

③  aspl> v d a12
    (view internals of set variable a12)

④  aspl> quit
     exit ASPL without saving changes in the namedspace WS1

 

● Tickable Predicates for f\

This f\ is tickable with predicates that are shown in the following table:

f\`_  gets the elements difference 
f\`c=  gets the elements difference such that they have the same checksum 
f\`c~  gets the elements difference such that they have different checksums 
f\`c~~  gets the elements difference such that they have all over different checksums 
f\`h=  gets the elements difference such that they have the same entropy 
f\`h~  gets the elements difference such that they have different entropies 
f\`h~~  gets the elements difference such that they have all over different entropies 
f\`mtm=  gets the elements difference such that they have the same make time 
f\`mtm~  gets the elements difference such that they have different make times 
f\`mtm~~  gets the elements difference such that they have all over different make times 
f\`mtm<  gets the elements difference such that they have a prior make time 
f\`mtm<=  gets the elements difference such that they have prior or same make time 
f\`mtm>  gets the elements difference such that they have more recent make time 
f\`mtm>=  gets the elements difference such that they have more recent or same make time 
f\`ks=  gets the elements difference such that they have the same ksum 
f\`ks~  gets the elements difference such that they have different ksums 
f\`ks~~  gets the elements difference such that they have all over different ksums 
© 2025 Bassem W. Jamaleddine