@@ -17,30 +17,29 @@ type Output = {
17
17
18
18
const builder = SQONBuilder ;
19
19
20
- const setFormulasDuo = ( s1 : v3SQON , s2 : v3SQON ) => [
21
- {
22
- operation : 'Q₁' ,
23
- count : undefined ,
24
- sqon : builder . from ( s1 ) ,
25
- } ,
26
- {
27
- operation : 'Q₂' ,
28
- count : undefined ,
29
- sqon : builder . from ( s2 ) ,
30
- } ,
31
- {
32
- operation : '(Q₁∩Q₂)' ,
33
- sqon : builder . and ( [ s1 , s2 ] ) ,
34
- } ,
35
- {
36
- operation : '(Q₁)-(Q₂)' ,
37
- sqon : builder . from ( s1 ) . not ( builder . from ( s2 ) ) ,
38
- } ,
39
- {
40
- operation : '(Q₂)-(Q₁)' ,
41
- sqon : builder . from ( s2 ) . not ( builder . from ( s1 ) ) ,
42
- } ,
43
- ] ;
20
+ const setFormulasDuo = ( s1 : v3SQON , s2 : v3SQON ) =>
21
+ [
22
+ {
23
+ operation : 'Q₁' ,
24
+ sqon : builder . from ( s1 ) ,
25
+ } ,
26
+ {
27
+ operation : 'Q₂' ,
28
+ sqon : builder . from ( s2 ) ,
29
+ } ,
30
+ {
31
+ operation : 'Q₁-Q₂' ,
32
+ sqon : builder . from ( s1 ) . not ( builder . from ( s2 ) ) ,
33
+ } ,
34
+ {
35
+ operation : 'Q₂-Q₁' ,
36
+ sqon : builder . from ( s2 ) . not ( builder . from ( s1 ) ) ,
37
+ } ,
38
+ {
39
+ operation : 'Q₁∩Q₂' ,
40
+ sqon : builder . and ( [ s1 , s2 ] ) ,
41
+ } ,
42
+ ] . map ( x => ( { ...x , sqon : renameFieldNameToField ( x . sqon ) } ) ) ;
44
43
45
44
const setFormulasTrio = ( s1 : v3SQON , s2 : v3SQON , s3 : v3SQON ) =>
46
45
[
@@ -57,8 +56,16 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
57
56
sqon : builder . from ( s3 ) ,
58
57
} ,
59
58
{
60
- operation : '(Q₁∩Q₂∩Q₃)' ,
61
- sqon : builder . and ( [ s1 , s2 , s3 ] ) ,
59
+ operation : '(Q₁)-(Q₂∩Q₃)' ,
60
+ sqon : builder . from ( s1 ) . not ( builder . and ( [ s2 , s3 ] ) ) ,
61
+ } ,
62
+ {
63
+ operation : '(Q₂)-(Q₁∩Q₃)' ,
64
+ sqon : builder . from ( s2 ) . not ( builder . and ( [ s1 , s3 ] ) ) ,
65
+ } ,
66
+ {
67
+ operation : '(Q₃)-(Q₁∩Q₂)' ,
68
+ sqon : builder . from ( s3 ) . not ( builder . and ( [ s1 , s2 ] ) ) ,
62
69
} ,
63
70
{
64
71
operation : '(Q₁∩Q₂)-(Q₃)' ,
@@ -73,16 +80,8 @@ const setFormulasTrio = (s1: v3SQON, s2: v3SQON, s3: v3SQON) =>
73
80
sqon : builder . and ( [ s1 , s3 ] ) . not ( s2 ) ,
74
81
} ,
75
82
{
76
- operation : '(Q₁)-(Q₂∩Q₃)' ,
77
- sqon : builder . from ( s1 ) . not ( builder . or ( [ s2 , s3 ] ) ) ,
78
- } ,
79
- {
80
- operation : '(Q₂)-(Q₁∩Q₃)' ,
81
- sqon : builder . from ( s2 ) . not ( builder . or ( [ s1 , s3 ] ) ) ,
82
- } ,
83
- {
84
- operation : '(Q₃)-(Q₁∩Q₂)' ,
85
- sqon : builder . from ( s3 ) . not ( builder . or ( [ s1 , s2 ] ) ) ,
83
+ operation : '(Q₁∩Q₂∩Q₃)' ,
84
+ sqon : builder . and ( [ s1 , s2 , s3 ] ) ,
86
85
} ,
87
86
] . map ( x => ( { ...x , sqon : renameFieldNameToField ( x . sqon ) } ) ) ;
88
87
0 commit comments