ASPL User Guide v 1.00
© 2025 Bassem W. Jamaleddine


D

   Functions to Compare Groups

In the sample workspace WS1FNCMP you can find the definition of various functions to compare two groups. The groups are compared at the subgroups and elements level. In addition the comparison is carried considering the attributes of the subgroups and the elements: the checksum attribute, and the mtime (make time or modification time) attribute.
The following figure shows the function definitions to compare two groups in the sample workspace WS1FNCMP.

full view

Image File

 -FG- Fig. D.1   [Defining Various Functions to Compare Two Groups][Defining Various Functions to Compare Two Groups]
ASPL © 2025 by Bassem W. Jamaleddine


The following table shows the functions to compare two groups. Each function is followed by an explanation on how the function definition compares the two groups. The line underneath the explanation shows the expression representative of the function name.

 -TB- Tab. D.1   [Functions to Compare Two Groups][Functions to Compare Two Groups]
   
cmp2sets()  compare two groups 
  {gU {g\, %%1 %%2}{g\, %%2 %%1}{g&, %%1 %%2}} 
cmp2mtmeq()  compare two groups where mtimes are the same 
  {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}{g&,`mtm= %%1 %%2}} 
cmp2mtm()  compare two groups where mtimes are different 
  gU {g\,`mtm= %%1 %%2}{g\,`mtm= %%2 %%1}{g&,`mtm~ %%1 %%2}} 
cmp2chkeq()  compare two groups where checksums are the same 
  {gU {g\,`c~ %%1 %%2}{g\,`c~ %%2 %%1}{g&,`c= %%1 %%2}} 
cmp2chk()  compare two groups where checksums are different 
  {gU {g\,`c= %%1 %%2}{g\,`c= %%2 %%1}{g&,`c~ %%1 %%2}} 
fcmp2sets()  compare the elements of two groups 
  {fU {f\, %%1 %%2}{f\, %%2 %%1}{f&, %%1 %%2}} 
fcmp2mtmeq()  compare the elements of two groups where mtimes are the same 
  {fU {f\,`mtm~ %%1 %%2}{f\,`mtm~ %%2 %%1}{f&,`mtm= %%1 %%2}} 
fcmp2mtm()  compare the elements of two groups where mtimes are different 
  {fU {f\,`mtm= %%1 %%2}{f\,`mtm= %%2 %%1}{f&,`mtm~ %%1 %%2}} 
fcmp2chkeq()  compare the elements of two groups where checksums are the same 
  {fU {f\,`c~ %%1 %%2}{f\,`c~ %%2 %%1}{f&,`c= %%1 %%2}} 
fcmp2chk()  compare the elements of two groups where checksums are different 
  {fU {f\,`c= %%1 %%2}{f\,`c= %%2 %%1}{f&,`c~ %%1 %%2}} 
dcmp2sets()  compare the subgroups of two groups 
  {dU {d\, %%1 %%2}{d\, %%2 %%1}{d&, %%1 %%2}} 
dcmp2mtmeq()  compare the subgroups of two groups where mtimes are the same 
  {dU {d\,`mtm~ %%1 %%2}{d\,`mtm~ %%2 %%1}{d&,`mtm= %%1 %%2}} 
dcmp2mtm()  compare the subgroups of two groups where mtimes are different 
  {dU {d\,`mtm= %%1 %%2}{d\,`mtm= %%2 %%1}{d&,`mtm~ %%1 %%2}} 
uni2diff()  get the union of the differences between two groups 
  {gU {g\, %%1 %%2}{g\, %%2 %%1}} 
g2symdiff()  get the Symmtric Difference between two groups 
  {gD %%1 %%2} 
f2symdiff()  get the elements Symmtric Difference between two groups 
  {fD %%1 %%2} 
duni2diff()  get the subgroups union of the differences between two groups 
  {dU {d\ %%1 %%2}{d\ %%2 %%1}} 
d2symdiff()  get the subgroups Symmtric Difference between two groups 
  {dD %%1 %%2} 
uni2diffmtmeq()  get the union of the differences between two groups where mtimes are the same 
  {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}} 
uni2diffmtm()  get the union of the differences between two groups where mtimes are different 
  {gU {g\,`mtm= %%1 %%2}{g\,`mtm= %%2 %%1}} 
uni2diffchkeq()  get the union of the differences between two groups where checksums are the same 
  {gU {g\,`c~ %%1 %%2}{g\,`c~ %%2 %%1}} 
uni2diffchk()  get the union of the differences between two groups where checksums are different 
  {gU {g\,`c= %%1 %%2}{g\,`c= %%2 %%1}} 
funi2diff()  get the elements union of the differences between two groups 
  {fU {f\, %%1 %%2}{f\, %%2 %%1}} 
funi2diffmtmeq()  get the elements union of the differences between two groups where mtimes are the same 
  {fU {f\,`mtm~ %%1 %%2}{f\,`mtm~ %%2 %%1}} 
funi2diffmtm()  get the elements union of the differences between two groups where mtimes are different 
  {fU {f\,`mtm= %%1 %%2}{f\,`mtm= %%2 %%1}} 
funi2diffchkeq()  get the elements union of the differences between two groups where checksums are the same 
  {fU {f\,`c~ %%1 %%2}{f\,`c~ %%2 %%1}} 
funi2diffchk()  get the elements union of the differences between two groups where checksums are different 
  {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}{g&,`mtm= %%1 %%2}} 
duni2diffmtmeq()  get the subgroups union of the differences between two groups where mtimes are the same 
  {dU {d\,`mtm~ %%1 %%2}{d\,`mtm~ %%2 %%1}} 
duni2diffmtm()  get the subgroups union of the differences between two groups where mtimes are different 
  {dU {d\,`mtm= %%1 %%2}{d\,`mtm= %%2 %%1}} 
Defining functions to compare groups in ASPL



These functions have been defined by typing the following code in ASPL. Each function is followed by an explanation on how the function definition compares the two groups.

aspl> DEF FN cmp2sets := {gU {g\, %%1 %%2}{g\, %%2 %%1}{g&, %%1 %%2}}
    Define the function to compare two groups

aspl> DEF FN cmp2mtmeq := {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}{g&,`mtm= %%1 %%2}}
    Define the function to compare two groups where mtimes are the same

aspl> DEF FN cmp2mtm := {gU {g\,`mtm= %%1 %%2}{g\,`mtm= %%2 %%1}{g&,`mtm~ %%1 %%2}}
    Define the function to compare two groups where mtimes are different

aspl> DEF FN cmp2chkeq := {gU {g\,`c~ %%1 %%2}{g\,`c~ %%2 %%1}{g&,`c= %%1 %%2}}
    Define the function to compare two groups where checksums are the same

aspl> DEF FN cmp2chk := {gU {g\,`c= %%1 %%2}{g\,`c= %%2 %%1}{g&,`c~ %%1 %%2}}
    Define the function to compare two groups where checksums are different

aspl> DEF FN fcmp2sets := {fU {f\, %%1 %%2}{f\, %%2 %%1}{f&, %%1 %%2}}
    Define the function to compare the elements of two groups

aspl> DEF FN fcmp2mtmeq := {fU {f\,`mtm~ %%1 %%2}{f\,`mtm~ %%2 %%1}{f&,`mtm= %%1 %%2}}
    Define the function to compare the elements of two groups where mtimes are the same

aspl> DEF FN fcmp2mtm := {fU {f\,`mtm= %%1 %%2}{f\,`mtm= %%2 %%1}{f&,`mtm~ %%1 %%2}}
    Define the function to compare the elements of two groups where mtimes are different

aspl> DEF FN fcmp2chkeq := {fU {f\,`c~ %%1 %%2}{f\,`c~ %%2 %%1}{f&,`c= %%1 %%2}}
    Define the function to compare the elements of two groups where checksums are the same

aspl> DEF FN fcmp2chk := {fU {f\,`c= %%1 %%2}{f\,`c= %%2 %%1}{f&,`c~ %%1 %%2}}
    Define the function to compare the elements of two groups where checksums are different

aspl> DEF FN dcmp2sets := {dU {d\, %%1 %%2}{d\, %%2 %%1}{d&, %%1 %%2}}
    Define the function to compare the subgroups of two groups

aspl> DEF FN dcmp2mtmeq := {dU {d\,`mtm~ %%1 %%2}{d\,`mtm~ %%2 %%1}{d&,`mtm= %%1 %%2}}
    Define the function to compare the subgroups of two groups where mtimes are the same

aspl> DEF FN dcmp2mtm := {dU {d\,`mtm= %%1 %%2}{d\,`mtm= %%2 %%1}{d&,`mtm~ %%1 %%2}}
    Define the function to compare the subgroups of two groups where mtimes are different

aspl> DEF FN uni2diff := {gU {g\, %%1 %%2}{g\, %%2 %%1}}
    Define the function to get the union of the differences between two groups

aspl> DEF FN g2symdiff := {gD %%1 %%2}
    Define the function to get the Symmtric Difference between two groups

aspl> DEF FN f2symdiff := {fD %%1 %%2}
    Define the function to get the elements Symmtric Difference between two groups

aspl> DEF FN duni2diff := {dU {d\ %%1 %%2}{d\ %%2 %%1}}
    Define the function to get the subgroups union of the differences between two groups

aspl> DEF FN d2symdiff := {dD %%1 %%2}
    Define the function to get the subgroups Symmtric Difference between two groups

aspl> DEF FN uni2diffmtmeq := {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}}
    Define the function to get the union of the differences between two groups where mtimes are the same

aspl> DEF FN uni2diffmtm := {gU {g\,`mtm= %%1 %%2}{g\,`mtm= %%2 %%1}}
    Define the function to get the union of the differences between two groups where mtimes are different

aspl> DEF FN uni2diffchkeq := {gU {g\,`c~ %%1 %%2}{g\,`c~ %%2 %%1}}
    Define the function to get the union of the differences between two groups where checksums are the same

aspl> DEF FN uni2diffchk := {gU {g\,`c= %%1 %%2}{g\,`c= %%2 %%1}}
    Define the function to get the union of the differences between two groups where checksums are different

aspl> DEF FN funi2diff := {fU {f\, %%1 %%2}{f\, %%2 %%1}}
    Define the function to get the elements union of the differences between two groups

aspl> DEF FN funi2diffmtmeq := {fU {f\,`mtm~ %%1 %%2}{f\,`mtm~ %%2 %%1}}
    Define the function to get the elements union of the differences between two groups where mtimes are the same

aspl> DEF FN funi2diffmtm := {fU {f\,`mtm= %%1 %%2}{f\,`mtm= %%2 %%1}}
    Define the function to get the elements union of the differences between two groups where mtimes are different

aspl> DEF FN funi2diffchkeq := {fU {f\,`c~ %%1 %%2}{f\,`c~ %%2 %%1}}
    Define the function to get the elements union of the differences between two groups where checksums are the same

aspl> DEF FN funi2diffchk := {fU {f\,`c= %%1 %%2}{f\,`c= %%2 %%1}}
    Define the function to get the elements union of the differences between two groups where checksums are different

aspl> DEF FN duni2diffmtmeq := {dU {d\,`mtm~ %%1 %%2}{d\,`mtm~ %%2 %%1}}
    Define the function to get the subgroups union of the differences between two groups where mtimes are the same

aspl> DEF FN duni2diffmtm := {dU {d\,`mtm= %%1 %%2}{d\,`mtm= %%2 %%1}}
    Define the function to get the subgroups union of the differences between two groups where mtimes are different





The following script run-functions-to-compare-groups.aspl executes various ASPL functions to compare two groups.

 -LIS- Listing. D.1   [Script run-functions-to-compare-groups.aspl][Script run-functions-to-compare-groups.aspl]
(raw text)
1.      #!/usr/bin/env /opt/ASPLv1.00/bin/aspl
2.      #ENVARG= -groupingclass POSIX -wsname WS1FNCMP -singlepass 
3.      
4.      
      ;;*********************************************************************** 
5.      ;;   run-functions-to-compare-groups.aspl
6.      ;;
7.      ;;   This script shows how to run the functions to compare two groups.
8.      ;;   Various functions are defined to compare groups, their subgroups,
9.      ;    and their elements.
10.     ;;
11.     
      ;;*********************************************************************** 
12.     
13.     def
14.     
15.     a1 = ggdir(dir,/tmp/aa1,nmdir,*,nmfl,*,calchksum,1,calentropy,1)
16.     a2 = ggdir(dir,/tmp/aa2,nmdir,*,nmfl,*,calchksum,1,calentropy,1)
17.     
18.     printblock *** CALLING cmp2sets() to compare two groups ***%%%CR*** {gU 
      {g\, %%1 
19.          %%2}{g\, %%2 %%1}{g&,  %%1 %%2}} *** 
20.     FN cmp2sets(a1,a2)
21.     printblock *** CALLING cmp2mtmeq() to compare two groups where mtimes 
      are the same 
22.          ***%%%CR*** {gU {g\,`mtm~ %%1 %%2}{g\,`mtm~ %%2 %%1}{g&,`mtm= %%1 
      %%2}} *** 
23.     FN cmp2mtmeq(a1,a2)
24.     printblock *** CALLING cmp2mtm() to compare two groups where mtimes are 
      different 
25.          ***%%%CR*** {gU {g\,`mtm= %%1 %%2}{g\,`mtm= %%2 %%1}{g&,`mtm~ %%1 
      %%2}} *** 
26.     FN cmp2mtm(a1,a2)
27.     printblock *** CALLING cmp2chkeq() to compare two groups where checksums 
      are the same 
28.          ***%%%CR*** {gU {g\,`c~ %%1 %%2}{g\,`c~ %%2 %%1}{g&,`c= %%1 %%2}} 
      *** 
29.     FN cmp2chkeq(a1,a2)
30.     printblock *** CALLING cmp2chk() to compare two groups where checksums 
      are different 
31.          ***%%%CR*** {gU {g\,`c= %%1 %%2}{g\,`c= %%2 %%1}{g&,`c~ %%1 %%2}} 
      **** 
32.     FN cmp2chk(a1,a2)
33.     
34.     printblock *** CALLING fcmp2sets() to compare the elements of two groups 
      ***%%%CR*** {fU 
35.          {f\, %%1 %%2}{f\, %%2 %%1}{f&, %%1 %%2}} **** 
36.     FN fcmp2sets(a1,a2)
37.     printblock *** CALLING fcmp2mtmeq() to compare the elements of two 
      groups where mtimes 
38.          are the same ***%%%CR*** {fU {f\,`mtm~ %%1 %%2}{f\,`mtm~ %%2 
      %%1}{f&,`mtm= %%1 
39.          %%2}} *** 
40.     FN fcmp2mtmeq(a1,a2)
41.     printblock *** CALLING fcmp2mtm() to compare the elements of two groups 
      where mtimes are 
42.          different ***%%%CR*** {fU {f\,`mtm= %%1 %%2}{f\,`mtm= %%2 
      %%1}{f&,`mtm~ %%1 %%2}} 
43.          *** 
44.     FN fcmp2mtm(a1,a2)
45.     printblock *** CALLING fcmp2chkeq() to compare the elements of two 
      groups where 
46.          checksums are the same ***%%%CR*** {fU {f\,`c~ %%1 %%2}{f\,`c~ %%2 
      %%1}{f&,`c= %%1 
47.          %%2}} *** 
48.     FN fcmp2chkeq(a1,a2)
49.     printblock *** CALLING fcmp2chk() to compare the elements of two groups 
      where checksums 
50.          are different ***%%%CR*** {fU {f\,`c= %%1 %%2}{f\,`c= %%2 
      %%1}{f&,`c~ %%1 %%2}} *** 
51.     FN fcmp2chk(a1,a2)
52.     
53.     
54.     printblock *** CALLING dcmp2sets() to compare the subgroups of two 
      groups ***%%%CR*** 
55.          {dU {d\, %%1 %%2}{d\, %%2 %%1}{d&, %%1 %%2}} *** 
56.     FN dcmp2sets(a1,a2)
57.     printblock *** CALLING dcmp2mtmeq() to compare the subgroups of two 
      groups where mtimes 
58.          are the same ***%%%CR*** {dU {d\,`mtm~ %%1 %%2}{d\,`mtm~ %%2 
      %%1}{d&,`mtm= %%1 
59.          %%2}} *** 
60.     FN dcmp2mtmeq(a1,a2)
61.     printblock *** CALLING dcmp2mtm() to compare the subgroups of two groups 
      where mtimes 
62.          are different ***%%%CR*** {dU {d\,`mtm= %%1 %%2}{d\,`mtm= %%2 
      %%1}{d&,`mtm~ %%1 
63.          %%2}} **** 
64.     FN dcmp2mtm(a1,a2)
65.     
66.     printblock *** CALLING uni2diff() to get the union of the differences 
      between two groups 
67.          ***%%%CR*** {gU {g\,  %%1 %%2}{g\,  %%2 %%1}} *** 
68.     FN uni2diff(a1,a2)
69.     printblock *** CALLING g2symdiff() to get the Symmtric Difference 
      between two groups 
70.          ***%%%CR*** {gD %%1 %%2} *** 
71.     FN g2symdiff(a1,a2)
72.     
73.     printblock *** CALLING f2symdiff() to get the elements Symmtric 
      Difference between two 
74.          groups ***%%%CR*** {fD %%1 %%2} *** 
75.     FN f2symdiff(a1,a2)
76.     
77.     printblock *** CALLING duni2diff() to get the subgroups union of the 
      differences between 
78.          two groups ***%%%CR*** {dU {d\  %%1 %%2}{d\  %%2 %%1}} *** 
79.     FN duni2diff(a1,a2)
80.     printblock *** CALLING d2symdiff() to get the subgroups Symmtric 
      Difference between two 
81.          groups ***%%%CR*** {dD %%1 %%2} *** 
82.     FN d2symdiff(a1,a2)
83.     
84.     printblock *** CALLING uni2diffmtmeq() to get the union of the 
      differences between two 
85.          groups where mtimes are the same ***%%%CR*** {gU {g\,`mtm~  %%1 
      %%2}{g\,`mtm~  %%2 
86.          %%1}} *** 
87.     FN uni2diffmtmeq(a1,a2)
88.     printblock *** CALLING uni2diffmtm() to get the union of the differences 
      between two 
89.          groups where mtimes are different ***%%%CR*** {gU {g\,`mtm=  %%1 
      %%2}{g\,`mtm=  %%2 
90.          %%1}} *** 
91.     FN uni2diffmtm(a1,a2)
92.     
93.     printblock *** CALLING uni2diffchkeq() to get the union of the 
      differences between two 
94.          groups where checksums are the same ***%%%CR*** {gU {g\,`c~  %%1 
      %%2}{g\,`c~  %%2 
95.          %%1}} 
96.     FN uni2diffchkeq(a1,a2)
97.     printblock *** CALLING uni2diffchk() to get the union of the differences 
      between two 
98.          groups where checksums are different ***%%%CR*** {gU {g\,`c=  %%1 
      %%2}{g\,`c=  %%2 
99.          %%1}} *** 
100.    FN uni2diffchk(a1,a2)
101.    
102.    printblock *** CALLING funi2diff() to get the elements union of the 
      differences between 
103.         two groups ***%%%CR*** {fU {f\,  %%1 %%2}{f\,  %%2 %%1}} **** 
104.    FN funi2diff(a1,a2)
105.    
106.    printblock *** CALLING funi2diffmtmeq() to get the elements union of the 
      differences 
107.         between two groups where mtimes are the same ***%%%CR*** {fU 
      {f\,`mtm~  %%1 
108.         %%2}{f\,`mtm~  %%2 %%1}} *** 
109.    FN funi2diffmtmeq(a1,a2)
110.    printblock *** CALLING funi2diffmtm() to get the elements union of the 
      differences 
111.         between two groups where mtimes are different ***%%%CR*** {fU 
      {f\,`mtm=  %%1 
112.         %%2}{f\,`mtm=  %%2 %%1}} *** 
113.    FN funi2diffmtm(a1,a2)
114.    
115.    printblock *** CALLING funi2diffchkeq() to get the elements union of the 
      differences 
116.         between two groups where checksums are the same ***%%%CR*** {fU 
      {f\,`c~  %%1 
117.         %%2}{f\,`c~  %%2 %%1}} *** 
118.    FN funi2diffchkeq(a1,a2)
119.    printblock *** CALLING funi2diffchk() to get the elements union of the 
      differences 
120.         between two groups where checksums are different ***%%%CR*** {gU 
      {g\,`mtm~ %%1 
121.         %%2}{g\,`mtm~ %%2 %%1}{g&,`mtm= %%1 %%2}} *** 
122.    FN funi2diffchk(a1,a2)
123.    
124.    
125.    printblock *** CALLING duni2diffmtmeq() to get the subgroups union of 
      the differences 
126.         between two groups where mtimes are the same ***%%%CR*** {dU 
      {d\,`mtm~  %%1 
127.         %%2}{d\,`mtm~  %%2 %%1}} *** 
128.    FN duni2diffmtmeq(a1,a2)
129.    printblock *** CALLING duni2diffmtm() to get the subgroups union of the 
      differences 
130.         between two groups where mtimes are different ***%%%CR*** {dU 
      {d\,`mtm=  %%1 
131.         %%2}{d\,`mtm=  %%2 %%1}} *** 
132.    FN duni2diffmtm(a1,a2)
133.    
134.    endscript
135.    
136.    __END__
137.    
138.      $00 runs various functions to compare two groups
139.    
ASPL (C) 2025 Bassem Jamaleddine


The run of the various functions to compare two groups is shown in the following terminal.
viewme

 -TC- Display. D.1   [Script run-functions-to-compare-groups.aspl to test functions to compare groups]
run for run-functions-to-compare-groups.aspl