compostjs 0.0.11 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compost.js +34 -28
- package/dist/core.js +94 -73
- package/dist/fable_modules/fable-library-js.4.28.0/Array.d.ts +123 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Array.js +1242 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Async.d.ts +26 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Async.js +145 -0
- package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.d.ts +59 -0
- package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.js +183 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BigInt.d.ts +115 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BigInt.js +283 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.d.ts +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Boolean.d.ts +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Boolean.js +21 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CHANGELOG.md +100 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Char.d.ts +65 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Char.js +169 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Choice.d.ts +121 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.d.ts +7 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.d.ts +9 -0
- package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Date.d.ts +70 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Date.js +748 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.d.ts +63 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.js +268 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.d.ts +18 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Decimal.d.ts +45 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Decimal.js +212 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Double.d.ts +11 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Double.js +46 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Encoding.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Encoding.js +173 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Event.d.ts +31 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Event.js +93 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.d.ts +7 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.js +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.d.ts +17 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.js +69 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Global.d.ts +24 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Global.js +8 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Guid.d.ts +10 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Guid.js +142 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Int32.d.ts +28 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.4.28.0/List.d.ts +143 -0
- package/dist/fable_modules/fable-library-js.4.28.0/List.js +1273 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Long.d.ts +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Long.js +46 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.d.ts +25 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.js +93 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Map.d.ts +178 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Map.js +1396 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.js +127 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.d.ts +52 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.js +327 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.d.ts +39 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Native.d.ts +2 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Native.js +8 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Numeric.d.ts +19 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Numeric.js +71 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Observable.d.ts +32 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Observable.js +113 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Option.d.ts +28 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Option.js +96 -0
- package/dist/fable_modules/fable-library-js.4.28.0/README.md +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Random.d.ts +37 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Random.js +170 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Range.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Reflection.d.ts +119 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Reflection.js +461 -0
- package/dist/fable_modules/fable-library-js.4.28.0/RegExp.d.ts +10 -0
- package/dist/fable_modules/fable-library-js.4.28.0/RegExp.js +131 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Result.d.ts +37 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq.d.ts +165 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq.js +1378 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq2.d.ts +18 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Set.d.ts +190 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Set.js +1789 -0
- package/dist/fable_modules/fable-library-js.4.28.0/String.d.ts +58 -0
- package/dist/fable_modules/fable-library-js.4.28.0/String.js +554 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.d.ts +79 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.js +317 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Text.d.ts +38 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Text.js +162 -0
- package/dist/fable_modules/fable-library-js.4.28.0/SystemException.d.ts +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/SystemException.js +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.d.ts +15 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.d.ts +34 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.js +177 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Timer.d.ts +19 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Types.d.ts +58 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Types.js +208 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.d.ts +2 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Uri.d.ts +31 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Uri.js +159 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Util.d.ts +210 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Util.js +769 -0
- package/dist/fable_modules/fable-library-js.4.28.0/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.4.28.0/lib/big.d.ts +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/lib/big.js +825 -0
- package/dist/fable_modules/fable-library-js.4.28.0/package.json +24 -0
- package/dist/fable_modules/project_cracked.json +1 -0
- package/package.json +5 -4
- package/.claude/settings.local.json +0 -11
- package/copy-latest.sh +0 -1
- package/dist/fable-library.2.10.1/Array.js +0 -1336
- package/dist/fable-library.2.10.1/Async.js +0 -121
- package/dist/fable-library.2.10.1/AsyncBuilder.js +0 -200
- package/dist/fable-library.2.10.1/Date.js +0 -501
- package/dist/fable-library.2.10.1/Decimal.js +0 -208
- package/dist/fable-library.2.10.1/Event.js +0 -193
- package/dist/fable-library.2.10.1/Int32.js +0 -157
- package/dist/fable-library.2.10.1/List.js +0 -1234
- package/dist/fable-library.2.10.1/Long.js +0 -155
- package/dist/fable-library.2.10.1/Map.js +0 -1292
- package/dist/fable-library.2.10.1/MutableMap.js +0 -360
- package/dist/fable-library.2.10.1/MutableSet.js +0 -279
- package/dist/fable-library.2.10.1/Observable.js +0 -131
- package/dist/fable-library.2.10.1/Option.js +0 -118
- package/dist/fable-library.2.10.1/Reflection.js +0 -345
- package/dist/fable-library.2.10.1/RegExp.js +0 -118
- package/dist/fable-library.2.10.1/Seq.js +0 -917
- package/dist/fable-library.2.10.1/Set.js +0 -1692
- package/dist/fable-library.2.10.1/String.js +0 -679
- package/dist/fable-library.2.10.1/Types.js +0 -308
- package/dist/fable-library.2.10.1/Util.js +0 -761
- package/dist/helpers.js +0 -31
- package/dist/lib/big.js +0 -905
- package/dist/lib/long.js +0 -1375
- package/index.html +0 -49
|
@@ -0,0 +1,1789 @@
|
|
|
1
|
+
import { record_type, bool_type, list_type, option_type, class_type } from "./Reflection.js";
|
|
2
|
+
import { some, value as value_3 } from "./Option.js";
|
|
3
|
+
import { structuralHash, toIterator, disposeSafe, getEnumerator, isArrayLike } from "./Util.js";
|
|
4
|
+
import { toString, Record } from "./Types.js";
|
|
5
|
+
import { fold as fold_2, cons, singleton as singleton_1, empty as empty_1, ofArrayWithTail, tail, head, isEmpty as isEmpty_1, FSharpList } from "./List.js";
|
|
6
|
+
import { fold as fold_1, fill, setItem } from "./Array.js";
|
|
7
|
+
import { join } from "./String.js";
|
|
8
|
+
import { exists as exists_1, cache, forAll as forAll_1, fold as fold_3, reduce, iterate as iterate_1, map as map_1 } from "./Seq.js";
|
|
9
|
+
import { HashSet__get_Comparer, HashSet_$ctor_Z6150332D, HashSet } from "./MutableSet.js";
|
|
10
|
+
export class SetTreeLeaf$1 {
|
|
11
|
+
constructor(k) {
|
|
12
|
+
this.k = k;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function SetTreeLeaf$1_$reflection(gen0) {
|
|
16
|
+
return class_type("Set.SetTreeLeaf`1", [gen0], SetTreeLeaf$1);
|
|
17
|
+
}
|
|
18
|
+
export function SetTreeLeaf$1_$ctor_2B595(k) {
|
|
19
|
+
return new SetTreeLeaf$1(k);
|
|
20
|
+
}
|
|
21
|
+
export function SetTreeLeaf$1__get_Key(_) {
|
|
22
|
+
return _.k;
|
|
23
|
+
}
|
|
24
|
+
export class SetTreeNode$1 extends SetTreeLeaf$1 {
|
|
25
|
+
constructor(v, left, right, h) {
|
|
26
|
+
super(v);
|
|
27
|
+
this.left = left;
|
|
28
|
+
this.right = right;
|
|
29
|
+
this.h = (h | 0);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export function SetTreeNode$1_$reflection(gen0) {
|
|
33
|
+
return class_type("Set.SetTreeNode`1", [gen0], SetTreeNode$1, SetTreeLeaf$1_$reflection(gen0));
|
|
34
|
+
}
|
|
35
|
+
export function SetTreeNode$1_$ctor_5F465FC9(v, left, right, h) {
|
|
36
|
+
return new SetTreeNode$1(v, left, right, h);
|
|
37
|
+
}
|
|
38
|
+
export function SetTreeNode$1__get_Left(_) {
|
|
39
|
+
return _.left;
|
|
40
|
+
}
|
|
41
|
+
export function SetTreeNode$1__get_Right(_) {
|
|
42
|
+
return _.right;
|
|
43
|
+
}
|
|
44
|
+
export function SetTreeNode$1__get_Height(_) {
|
|
45
|
+
return _.h;
|
|
46
|
+
}
|
|
47
|
+
export function SetTreeModule_empty() {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
export function SetTreeModule_countAux(t_mut, acc_mut) {
|
|
51
|
+
SetTreeModule_countAux: while (true) {
|
|
52
|
+
const t = t_mut, acc = acc_mut;
|
|
53
|
+
if (t != null) {
|
|
54
|
+
const t2 = value_3(t);
|
|
55
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
56
|
+
const tn = t2;
|
|
57
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
58
|
+
acc_mut = SetTreeModule_countAux(SetTreeNode$1__get_Right(tn), acc + 1);
|
|
59
|
+
continue SetTreeModule_countAux;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
return (acc + 1) | 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return acc | 0;
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export function SetTreeModule_count(s) {
|
|
72
|
+
return SetTreeModule_countAux(s, 0);
|
|
73
|
+
}
|
|
74
|
+
export function SetTreeModule_mk(l, k, r) {
|
|
75
|
+
let tn, tn_1;
|
|
76
|
+
let hl;
|
|
77
|
+
const t = l;
|
|
78
|
+
if (t != null) {
|
|
79
|
+
const t2 = value_3(t);
|
|
80
|
+
hl = ((t2 instanceof SetTreeNode$1) ? ((tn = t2, SetTreeNode$1__get_Height(tn))) : 1);
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
hl = 0;
|
|
84
|
+
}
|
|
85
|
+
let hr;
|
|
86
|
+
const t_1 = r;
|
|
87
|
+
if (t_1 != null) {
|
|
88
|
+
const t2_1 = value_3(t_1);
|
|
89
|
+
hr = ((t2_1 instanceof SetTreeNode$1) ? ((tn_1 = t2_1, SetTreeNode$1__get_Height(tn_1))) : 1);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
hr = 0;
|
|
93
|
+
}
|
|
94
|
+
const m = ((hl < hr) ? hr : hl) | 0;
|
|
95
|
+
if (m === 0) {
|
|
96
|
+
return SetTreeLeaf$1_$ctor_2B595(k);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
return SetTreeNode$1_$ctor_5F465FC9(k, l, r, m + 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export function SetTreeModule_rebalance(t1, v, t2) {
|
|
103
|
+
let tn, tn_1, t_2, t2_3, tn_2, t_3, t2_4, tn_3;
|
|
104
|
+
let t1h;
|
|
105
|
+
const t = t1;
|
|
106
|
+
if (t != null) {
|
|
107
|
+
const t2_1 = value_3(t);
|
|
108
|
+
t1h = ((t2_1 instanceof SetTreeNode$1) ? ((tn = t2_1, SetTreeNode$1__get_Height(tn))) : 1);
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
t1h = 0;
|
|
112
|
+
}
|
|
113
|
+
let t2h;
|
|
114
|
+
const t_1 = t2;
|
|
115
|
+
if (t_1 != null) {
|
|
116
|
+
const t2_2 = value_3(t_1);
|
|
117
|
+
t2h = ((t2_2 instanceof SetTreeNode$1) ? ((tn_1 = t2_2, SetTreeNode$1__get_Height(tn_1))) : 1);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
t2h = 0;
|
|
121
|
+
}
|
|
122
|
+
if (t2h > (t1h + 2)) {
|
|
123
|
+
const matchValue = value_3(t2);
|
|
124
|
+
if (matchValue instanceof SetTreeNode$1) {
|
|
125
|
+
const t2$0027 = matchValue;
|
|
126
|
+
if (((t_2 = SetTreeNode$1__get_Left(t2$0027), (t_2 != null) ? ((t2_3 = value_3(t_2), (t2_3 instanceof SetTreeNode$1) ? ((tn_2 = t2_3, SetTreeNode$1__get_Height(tn_2))) : 1)) : 0)) > (t1h + 1)) {
|
|
127
|
+
const matchValue_1 = value_3(SetTreeNode$1__get_Left(t2$0027));
|
|
128
|
+
if (matchValue_1 instanceof SetTreeNode$1) {
|
|
129
|
+
const t2l = matchValue_1;
|
|
130
|
+
return SetTreeModule_mk(SetTreeModule_mk(t1, v, SetTreeNode$1__get_Left(t2l)), SetTreeLeaf$1__get_Key(t2l), SetTreeModule_mk(SetTreeNode$1__get_Right(t2l), SetTreeLeaf$1__get_Key(t2$0027), SetTreeNode$1__get_Right(t2$0027)));
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
throw new Error("internal error: Set.rebalance");
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return SetTreeModule_mk(SetTreeModule_mk(t1, v, SetTreeNode$1__get_Left(t2$0027)), SetTreeLeaf$1__get_Key(t2$0027), SetTreeNode$1__get_Right(t2$0027));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
throw new Error("internal error: Set.rebalance");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else if (t1h > (t2h + 2)) {
|
|
145
|
+
const matchValue_2 = value_3(t1);
|
|
146
|
+
if (matchValue_2 instanceof SetTreeNode$1) {
|
|
147
|
+
const t1$0027 = matchValue_2;
|
|
148
|
+
if (((t_3 = SetTreeNode$1__get_Right(t1$0027), (t_3 != null) ? ((t2_4 = value_3(t_3), (t2_4 instanceof SetTreeNode$1) ? ((tn_3 = t2_4, SetTreeNode$1__get_Height(tn_3))) : 1)) : 0)) > (t2h + 1)) {
|
|
149
|
+
const matchValue_3 = value_3(SetTreeNode$1__get_Right(t1$0027));
|
|
150
|
+
if (matchValue_3 instanceof SetTreeNode$1) {
|
|
151
|
+
const t1r = matchValue_3;
|
|
152
|
+
return SetTreeModule_mk(SetTreeModule_mk(SetTreeNode$1__get_Left(t1$0027), SetTreeLeaf$1__get_Key(t1$0027), SetTreeNode$1__get_Left(t1r)), SetTreeLeaf$1__get_Key(t1r), SetTreeModule_mk(SetTreeNode$1__get_Right(t1r), v, t2));
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
throw new Error("internal error: Set.rebalance");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return SetTreeModule_mk(SetTreeNode$1__get_Left(t1$0027), SetTreeLeaf$1__get_Key(t1$0027), SetTreeModule_mk(SetTreeNode$1__get_Right(t1$0027), v, t2));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
throw new Error("internal error: Set.rebalance");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return SetTreeModule_mk(t1, v, t2);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export function SetTreeModule_add(comparer, k, t) {
|
|
171
|
+
if (t != null) {
|
|
172
|
+
const t2 = value_3(t);
|
|
173
|
+
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
174
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
175
|
+
const tn = t2;
|
|
176
|
+
if (c < 0) {
|
|
177
|
+
return SetTreeModule_rebalance(SetTreeModule_add(comparer, k, SetTreeNode$1__get_Left(tn)), SetTreeLeaf$1__get_Key(tn), SetTreeNode$1__get_Right(tn));
|
|
178
|
+
}
|
|
179
|
+
else if (c === 0) {
|
|
180
|
+
return t;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
return SetTreeModule_rebalance(SetTreeNode$1__get_Left(tn), SetTreeLeaf$1__get_Key(tn), SetTreeModule_add(comparer, k, SetTreeNode$1__get_Right(tn)));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
const c_1 = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
188
|
+
if (c_1 < 0) {
|
|
189
|
+
return SetTreeNode$1_$ctor_5F465FC9(k, SetTreeModule_empty(), t, 2);
|
|
190
|
+
}
|
|
191
|
+
else if (c_1 === 0) {
|
|
192
|
+
return t;
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
return SetTreeNode$1_$ctor_5F465FC9(k, t, SetTreeModule_empty(), 2);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
return SetTreeLeaf$1_$ctor_2B595(k);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export function SetTreeModule_balance(comparer, t1, k, t2) {
|
|
204
|
+
if (t1 != null) {
|
|
205
|
+
const t1$0027 = value_3(t1);
|
|
206
|
+
if (t2 != null) {
|
|
207
|
+
const t2$0027 = value_3(t2);
|
|
208
|
+
if (t1$0027 instanceof SetTreeNode$1) {
|
|
209
|
+
const t1n = t1$0027;
|
|
210
|
+
if (t2$0027 instanceof SetTreeNode$1) {
|
|
211
|
+
const t2n = t2$0027;
|
|
212
|
+
if ((SetTreeNode$1__get_Height(t1n) + 2) < SetTreeNode$1__get_Height(t2n)) {
|
|
213
|
+
return SetTreeModule_rebalance(SetTreeModule_balance(comparer, t1, k, SetTreeNode$1__get_Left(t2n)), SetTreeLeaf$1__get_Key(t2n), SetTreeNode$1__get_Right(t2n));
|
|
214
|
+
}
|
|
215
|
+
else if ((SetTreeNode$1__get_Height(t2n) + 2) < SetTreeNode$1__get_Height(t1n)) {
|
|
216
|
+
return SetTreeModule_rebalance(SetTreeNode$1__get_Left(t1n), SetTreeLeaf$1__get_Key(t1n), SetTreeModule_balance(comparer, SetTreeNode$1__get_Right(t1n), k, t2));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
return SetTreeModule_mk(t1, k, t2);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
return SetTreeModule_add(comparer, k, SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t2$0027), t1));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
return SetTreeModule_add(comparer, k, SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t1$0027), t2));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return SetTreeModule_add(comparer, k, t1);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
return SetTreeModule_add(comparer, k, t2);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
export function SetTreeModule_split(comparer, pivot, t) {
|
|
239
|
+
if (t != null) {
|
|
240
|
+
const t2 = value_3(t);
|
|
241
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
242
|
+
const tn = t2;
|
|
243
|
+
const c = comparer.Compare(pivot, SetTreeLeaf$1__get_Key(tn)) | 0;
|
|
244
|
+
if (c < 0) {
|
|
245
|
+
const patternInput = SetTreeModule_split(comparer, pivot, SetTreeNode$1__get_Left(tn));
|
|
246
|
+
return [patternInput[0], patternInput[1], SetTreeModule_balance(comparer, patternInput[2], SetTreeLeaf$1__get_Key(tn), SetTreeNode$1__get_Right(tn))];
|
|
247
|
+
}
|
|
248
|
+
else if (c === 0) {
|
|
249
|
+
return [SetTreeNode$1__get_Left(tn), true, SetTreeNode$1__get_Right(tn)];
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
const patternInput_1 = SetTreeModule_split(comparer, pivot, SetTreeNode$1__get_Right(tn));
|
|
253
|
+
return [SetTreeModule_balance(comparer, SetTreeNode$1__get_Left(tn), SetTreeLeaf$1__get_Key(tn), patternInput_1[0]), patternInput_1[1], patternInput_1[2]];
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
const c_1 = comparer.Compare(SetTreeLeaf$1__get_Key(t2), pivot) | 0;
|
|
258
|
+
if (c_1 < 0) {
|
|
259
|
+
return [t, false, SetTreeModule_empty()];
|
|
260
|
+
}
|
|
261
|
+
else if (c_1 === 0) {
|
|
262
|
+
return [SetTreeModule_empty(), true, SetTreeModule_empty()];
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
return [SetTreeModule_empty(), false, t];
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
return [SetTreeModule_empty(), false, SetTreeModule_empty()];
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export function SetTreeModule_spliceOutSuccessor(t) {
|
|
274
|
+
if (t != null) {
|
|
275
|
+
const t2 = value_3(t);
|
|
276
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
277
|
+
const tn = t2;
|
|
278
|
+
if (SetTreeNode$1__get_Left(tn) == null) {
|
|
279
|
+
return [SetTreeLeaf$1__get_Key(tn), SetTreeNode$1__get_Right(tn)];
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
const patternInput = SetTreeModule_spliceOutSuccessor(SetTreeNode$1__get_Left(tn));
|
|
283
|
+
return [patternInput[0], SetTreeModule_mk(patternInput[1], SetTreeLeaf$1__get_Key(tn), SetTreeNode$1__get_Right(tn))];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
return [SetTreeLeaf$1__get_Key(t2), SetTreeModule_empty()];
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
throw new Error("internal error: Set.spliceOutSuccessor");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
export function SetTreeModule_remove(comparer, k, t) {
|
|
295
|
+
if (t != null) {
|
|
296
|
+
const t2 = value_3(t);
|
|
297
|
+
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
298
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
299
|
+
const tn = t2;
|
|
300
|
+
if (c < 0) {
|
|
301
|
+
return SetTreeModule_rebalance(SetTreeModule_remove(comparer, k, SetTreeNode$1__get_Left(tn)), SetTreeLeaf$1__get_Key(tn), SetTreeNode$1__get_Right(tn));
|
|
302
|
+
}
|
|
303
|
+
else if (c === 0) {
|
|
304
|
+
if (SetTreeNode$1__get_Left(tn) == null) {
|
|
305
|
+
return SetTreeNode$1__get_Right(tn);
|
|
306
|
+
}
|
|
307
|
+
else if (SetTreeNode$1__get_Right(tn) == null) {
|
|
308
|
+
return SetTreeNode$1__get_Left(tn);
|
|
309
|
+
}
|
|
310
|
+
else {
|
|
311
|
+
const patternInput = SetTreeModule_spliceOutSuccessor(SetTreeNode$1__get_Right(tn));
|
|
312
|
+
return SetTreeModule_mk(SetTreeNode$1__get_Left(tn), patternInput[0], patternInput[1]);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
return SetTreeModule_rebalance(SetTreeNode$1__get_Left(tn), SetTreeLeaf$1__get_Key(tn), SetTreeModule_remove(comparer, k, SetTreeNode$1__get_Right(tn)));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
else if (c === 0) {
|
|
320
|
+
return SetTreeModule_empty();
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
return t;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
return t;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
export function SetTreeModule_mem(comparer_mut, k_mut, t_mut) {
|
|
331
|
+
SetTreeModule_mem: while (true) {
|
|
332
|
+
const comparer = comparer_mut, k = k_mut, t = t_mut;
|
|
333
|
+
if (t != null) {
|
|
334
|
+
const t2 = value_3(t);
|
|
335
|
+
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
336
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
337
|
+
const tn = t2;
|
|
338
|
+
if (c < 0) {
|
|
339
|
+
comparer_mut = comparer;
|
|
340
|
+
k_mut = k;
|
|
341
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
342
|
+
continue SetTreeModule_mem;
|
|
343
|
+
}
|
|
344
|
+
else if (c === 0) {
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
else {
|
|
348
|
+
comparer_mut = comparer;
|
|
349
|
+
k_mut = k;
|
|
350
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
351
|
+
continue SetTreeModule_mem;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
return c === 0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
export function SetTreeModule_iter(f_mut, t_mut) {
|
|
365
|
+
SetTreeModule_iter: while (true) {
|
|
366
|
+
const f = f_mut, t = t_mut;
|
|
367
|
+
if (t != null) {
|
|
368
|
+
const t2 = value_3(t);
|
|
369
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
370
|
+
const tn = t2;
|
|
371
|
+
SetTreeModule_iter(f, SetTreeNode$1__get_Left(tn));
|
|
372
|
+
f(SetTreeLeaf$1__get_Key(tn));
|
|
373
|
+
f_mut = f;
|
|
374
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
375
|
+
continue SetTreeModule_iter;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
f(SetTreeLeaf$1__get_Key(t2));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
export function SetTreeModule_foldBackOpt(f_mut, t_mut, x_mut) {
|
|
385
|
+
SetTreeModule_foldBackOpt: while (true) {
|
|
386
|
+
const f = f_mut, t = t_mut, x = x_mut;
|
|
387
|
+
if (t != null) {
|
|
388
|
+
const t2 = value_3(t);
|
|
389
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
390
|
+
const tn = t2;
|
|
391
|
+
f_mut = f;
|
|
392
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
393
|
+
x_mut = f(SetTreeLeaf$1__get_Key(tn), SetTreeModule_foldBackOpt(f, SetTreeNode$1__get_Right(tn), x));
|
|
394
|
+
continue SetTreeModule_foldBackOpt;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
return f(SetTreeLeaf$1__get_Key(t2), x);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
return x;
|
|
402
|
+
}
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
export function SetTreeModule_foldBack(f, m, x) {
|
|
407
|
+
return SetTreeModule_foldBackOpt(f, m, x);
|
|
408
|
+
}
|
|
409
|
+
export function SetTreeModule_foldOpt(f_mut, x_mut, t_mut) {
|
|
410
|
+
SetTreeModule_foldOpt: while (true) {
|
|
411
|
+
const f = f_mut, x = x_mut, t = t_mut;
|
|
412
|
+
if (t != null) {
|
|
413
|
+
const t2 = value_3(t);
|
|
414
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
415
|
+
const tn = t2;
|
|
416
|
+
f_mut = f;
|
|
417
|
+
x_mut = f(SetTreeModule_foldOpt(f, x, SetTreeNode$1__get_Left(tn)), SetTreeLeaf$1__get_Key(tn));
|
|
418
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
419
|
+
continue SetTreeModule_foldOpt;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
return f(x, SetTreeLeaf$1__get_Key(t2));
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
return x;
|
|
427
|
+
}
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
export function SetTreeModule_fold(f, x, m) {
|
|
432
|
+
return SetTreeModule_foldOpt(f, x, m);
|
|
433
|
+
}
|
|
434
|
+
export function SetTreeModule_forall(f_mut, t_mut) {
|
|
435
|
+
SetTreeModule_forall: while (true) {
|
|
436
|
+
const f = f_mut, t = t_mut;
|
|
437
|
+
if (t != null) {
|
|
438
|
+
const t2 = value_3(t);
|
|
439
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
440
|
+
const tn = t2;
|
|
441
|
+
if (f(SetTreeLeaf$1__get_Key(tn)) && SetTreeModule_forall(f, SetTreeNode$1__get_Left(tn))) {
|
|
442
|
+
f_mut = f;
|
|
443
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
444
|
+
continue SetTreeModule_forall;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
return f(SetTreeLeaf$1__get_Key(t2));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
else {
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
export function SetTreeModule_exists(f_mut, t_mut) {
|
|
461
|
+
SetTreeModule_exists: while (true) {
|
|
462
|
+
const f = f_mut, t = t_mut;
|
|
463
|
+
if (t != null) {
|
|
464
|
+
const t2 = value_3(t);
|
|
465
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
466
|
+
const tn = t2;
|
|
467
|
+
if (f(SetTreeLeaf$1__get_Key(tn)) ? true : SetTreeModule_exists(f, SetTreeNode$1__get_Left(tn))) {
|
|
468
|
+
return true;
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
f_mut = f;
|
|
472
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
473
|
+
continue SetTreeModule_exists;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
return f(SetTreeLeaf$1__get_Key(t2));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
export function SetTreeModule_subset(comparer, a, b) {
|
|
487
|
+
return SetTreeModule_forall((x) => SetTreeModule_mem(comparer, x, b), a);
|
|
488
|
+
}
|
|
489
|
+
export function SetTreeModule_properSubset(comparer, a, b) {
|
|
490
|
+
if (SetTreeModule_forall((x) => SetTreeModule_mem(comparer, x, b), a)) {
|
|
491
|
+
return SetTreeModule_exists((x_1) => !SetTreeModule_mem(comparer, x_1, a), b);
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
export function SetTreeModule_filterAux(comparer_mut, f_mut, t_mut, acc_mut) {
|
|
498
|
+
SetTreeModule_filterAux: while (true) {
|
|
499
|
+
const comparer = comparer_mut, f = f_mut, t = t_mut, acc = acc_mut;
|
|
500
|
+
if (t != null) {
|
|
501
|
+
const t2 = value_3(t);
|
|
502
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
503
|
+
const tn = t2;
|
|
504
|
+
const acc_1 = f(SetTreeLeaf$1__get_Key(tn)) ? SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(tn), acc) : acc;
|
|
505
|
+
comparer_mut = comparer;
|
|
506
|
+
f_mut = f;
|
|
507
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
508
|
+
acc_mut = SetTreeModule_filterAux(comparer, f, SetTreeNode$1__get_Right(tn), acc_1);
|
|
509
|
+
continue SetTreeModule_filterAux;
|
|
510
|
+
}
|
|
511
|
+
else if (f(SetTreeLeaf$1__get_Key(t2))) {
|
|
512
|
+
return SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t2), acc);
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
return acc;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
else {
|
|
519
|
+
return acc;
|
|
520
|
+
}
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
export function SetTreeModule_filter(comparer, f, s) {
|
|
525
|
+
return SetTreeModule_filterAux(comparer, f, s, SetTreeModule_empty());
|
|
526
|
+
}
|
|
527
|
+
export function SetTreeModule_diffAux(comparer_mut, t_mut, acc_mut) {
|
|
528
|
+
SetTreeModule_diffAux: while (true) {
|
|
529
|
+
const comparer = comparer_mut, t = t_mut, acc = acc_mut;
|
|
530
|
+
if (acc == null) {
|
|
531
|
+
return acc;
|
|
532
|
+
}
|
|
533
|
+
else if (t != null) {
|
|
534
|
+
const t2 = value_3(t);
|
|
535
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
536
|
+
const tn = t2;
|
|
537
|
+
comparer_mut = comparer;
|
|
538
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
539
|
+
acc_mut = SetTreeModule_diffAux(comparer, SetTreeNode$1__get_Right(tn), SetTreeModule_remove(comparer, SetTreeLeaf$1__get_Key(tn), acc));
|
|
540
|
+
continue SetTreeModule_diffAux;
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
return SetTreeModule_remove(comparer, SetTreeLeaf$1__get_Key(t2), acc);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
else {
|
|
547
|
+
return acc;
|
|
548
|
+
}
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
export function SetTreeModule_diff(comparer, a, b) {
|
|
553
|
+
return SetTreeModule_diffAux(comparer, b, a);
|
|
554
|
+
}
|
|
555
|
+
export function SetTreeModule_union(comparer, t1, t2) {
|
|
556
|
+
if (t1 != null) {
|
|
557
|
+
const t1$0027 = value_3(t1);
|
|
558
|
+
if (t2 != null) {
|
|
559
|
+
const t2$0027 = value_3(t2);
|
|
560
|
+
if (t1$0027 instanceof SetTreeNode$1) {
|
|
561
|
+
const t1n = t1$0027;
|
|
562
|
+
if (t2$0027 instanceof SetTreeNode$1) {
|
|
563
|
+
const t2n = t2$0027;
|
|
564
|
+
if (SetTreeNode$1__get_Height(t1n) > SetTreeNode$1__get_Height(t2n)) {
|
|
565
|
+
const patternInput = SetTreeModule_split(comparer, SetTreeLeaf$1__get_Key(t1n), t2);
|
|
566
|
+
return SetTreeModule_balance(comparer, SetTreeModule_union(comparer, SetTreeNode$1__get_Left(t1n), patternInput[0]), SetTreeLeaf$1__get_Key(t1n), SetTreeModule_union(comparer, SetTreeNode$1__get_Right(t1n), patternInput[2]));
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
const patternInput_1 = SetTreeModule_split(comparer, SetTreeLeaf$1__get_Key(t2n), t1);
|
|
570
|
+
return SetTreeModule_balance(comparer, SetTreeModule_union(comparer, SetTreeNode$1__get_Left(t2n), patternInput_1[0]), SetTreeLeaf$1__get_Key(t2n), SetTreeModule_union(comparer, SetTreeNode$1__get_Right(t2n), patternInput_1[2]));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
return SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t2$0027), t1);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
return SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t1$0027), t2);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
return t1;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
return t2;
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
export function SetTreeModule_intersectionAux(comparer_mut, b_mut, t_mut, acc_mut) {
|
|
590
|
+
SetTreeModule_intersectionAux: while (true) {
|
|
591
|
+
const comparer = comparer_mut, b = b_mut, t = t_mut, acc = acc_mut;
|
|
592
|
+
if (t != null) {
|
|
593
|
+
const t2 = value_3(t);
|
|
594
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
595
|
+
const tn = t2;
|
|
596
|
+
const acc_1 = SetTreeModule_intersectionAux(comparer, b, SetTreeNode$1__get_Right(tn), acc);
|
|
597
|
+
const acc_2 = SetTreeModule_mem(comparer, SetTreeLeaf$1__get_Key(tn), b) ? SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(tn), acc_1) : acc_1;
|
|
598
|
+
comparer_mut = comparer;
|
|
599
|
+
b_mut = b;
|
|
600
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
601
|
+
acc_mut = acc_2;
|
|
602
|
+
continue SetTreeModule_intersectionAux;
|
|
603
|
+
}
|
|
604
|
+
else if (SetTreeModule_mem(comparer, SetTreeLeaf$1__get_Key(t2), b)) {
|
|
605
|
+
return SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(t2), acc);
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
return acc;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
return acc;
|
|
613
|
+
}
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
export function SetTreeModule_intersection(comparer, a, b) {
|
|
618
|
+
return SetTreeModule_intersectionAux(comparer, b, a, SetTreeModule_empty());
|
|
619
|
+
}
|
|
620
|
+
export function SetTreeModule_partition1(comparer, f, k, acc1, acc2) {
|
|
621
|
+
if (f(k)) {
|
|
622
|
+
return [SetTreeModule_add(comparer, k, acc1), acc2];
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
return [acc1, SetTreeModule_add(comparer, k, acc2)];
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
export function SetTreeModule_partitionAux(comparer_mut, f_mut, t_mut, acc__mut, acc__1_mut) {
|
|
629
|
+
SetTreeModule_partitionAux: while (true) {
|
|
630
|
+
const comparer = comparer_mut, f = f_mut, t = t_mut, acc_ = acc__mut, acc__1 = acc__1_mut;
|
|
631
|
+
const acc = [acc_, acc__1];
|
|
632
|
+
if (t != null) {
|
|
633
|
+
const t2 = value_3(t);
|
|
634
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
635
|
+
const tn = t2;
|
|
636
|
+
const acc_1 = SetTreeModule_partitionAux(comparer, f, SetTreeNode$1__get_Right(tn), acc[0], acc[1]);
|
|
637
|
+
const acc_4 = SetTreeModule_partition1(comparer, f, SetTreeLeaf$1__get_Key(tn), acc_1[0], acc_1[1]);
|
|
638
|
+
comparer_mut = comparer;
|
|
639
|
+
f_mut = f;
|
|
640
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
641
|
+
acc__mut = acc_4[0];
|
|
642
|
+
acc__1_mut = acc_4[1];
|
|
643
|
+
continue SetTreeModule_partitionAux;
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
return SetTreeModule_partition1(comparer, f, SetTreeLeaf$1__get_Key(t2), acc[0], acc[1]);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
return acc;
|
|
651
|
+
}
|
|
652
|
+
break;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
export function SetTreeModule_partition(comparer, f, s) {
|
|
656
|
+
return SetTreeModule_partitionAux(comparer, f, s, SetTreeModule_empty(), SetTreeModule_empty());
|
|
657
|
+
}
|
|
658
|
+
export function SetTreeModule_minimumElementAux(t_mut, n_mut) {
|
|
659
|
+
SetTreeModule_minimumElementAux: while (true) {
|
|
660
|
+
const t = t_mut, n = n_mut;
|
|
661
|
+
if (t != null) {
|
|
662
|
+
const t2 = value_3(t);
|
|
663
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
664
|
+
const tn = t2;
|
|
665
|
+
t_mut = SetTreeNode$1__get_Left(tn);
|
|
666
|
+
n_mut = SetTreeLeaf$1__get_Key(tn);
|
|
667
|
+
continue SetTreeModule_minimumElementAux;
|
|
668
|
+
}
|
|
669
|
+
else {
|
|
670
|
+
return SetTreeLeaf$1__get_Key(t2);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
return n;
|
|
675
|
+
}
|
|
676
|
+
break;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
export function SetTreeModule_minimumElementOpt(t) {
|
|
680
|
+
if (t != null) {
|
|
681
|
+
const t2 = value_3(t);
|
|
682
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
683
|
+
const tn = t2;
|
|
684
|
+
return some(SetTreeModule_minimumElementAux(SetTreeNode$1__get_Left(tn), SetTreeLeaf$1__get_Key(tn)));
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
return some(SetTreeLeaf$1__get_Key(t2));
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
else {
|
|
691
|
+
return undefined;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
export function SetTreeModule_maximumElementAux(t_mut, n_mut) {
|
|
695
|
+
SetTreeModule_maximumElementAux: while (true) {
|
|
696
|
+
const t = t_mut, n = n_mut;
|
|
697
|
+
if (t != null) {
|
|
698
|
+
const t2 = value_3(t);
|
|
699
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
700
|
+
const tn = t2;
|
|
701
|
+
t_mut = SetTreeNode$1__get_Right(tn);
|
|
702
|
+
n_mut = SetTreeLeaf$1__get_Key(tn);
|
|
703
|
+
continue SetTreeModule_maximumElementAux;
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
return SetTreeLeaf$1__get_Key(t2);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
else {
|
|
710
|
+
return n;
|
|
711
|
+
}
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
export function SetTreeModule_maximumElementOpt(t) {
|
|
716
|
+
if (t != null) {
|
|
717
|
+
const t2 = value_3(t);
|
|
718
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
719
|
+
const tn = t2;
|
|
720
|
+
return some(SetTreeModule_maximumElementAux(SetTreeNode$1__get_Right(tn), SetTreeLeaf$1__get_Key(tn)));
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
return some(SetTreeLeaf$1__get_Key(t2));
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
return undefined;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
export function SetTreeModule_minimumElement(s) {
|
|
731
|
+
const matchValue = SetTreeModule_minimumElementOpt(s);
|
|
732
|
+
if (matchValue == null) {
|
|
733
|
+
throw new Error("Set contains no elements");
|
|
734
|
+
}
|
|
735
|
+
else {
|
|
736
|
+
return value_3(matchValue);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
export function SetTreeModule_maximumElement(s) {
|
|
740
|
+
const matchValue = SetTreeModule_maximumElementOpt(s);
|
|
741
|
+
if (matchValue == null) {
|
|
742
|
+
throw new Error("Set contains no elements");
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
return value_3(matchValue);
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
export class SetTreeModule_SetIterator$1 extends Record {
|
|
749
|
+
constructor(stack, started) {
|
|
750
|
+
super();
|
|
751
|
+
this.stack = stack;
|
|
752
|
+
this.started = started;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
export function SetTreeModule_SetIterator$1_$reflection(gen0) {
|
|
756
|
+
return record_type("Set.SetTreeModule.SetIterator`1", [gen0], SetTreeModule_SetIterator$1, () => [["stack", list_type(option_type(SetTreeLeaf$1_$reflection(gen0)))], ["started", bool_type]]);
|
|
757
|
+
}
|
|
758
|
+
export function SetTreeModule_collapseLHS(stack_mut) {
|
|
759
|
+
SetTreeModule_collapseLHS: while (true) {
|
|
760
|
+
const stack = stack_mut;
|
|
761
|
+
if (!isEmpty_1(stack)) {
|
|
762
|
+
const x = head(stack);
|
|
763
|
+
const rest = tail(stack);
|
|
764
|
+
if (x != null) {
|
|
765
|
+
const x2 = value_3(x);
|
|
766
|
+
if (x2 instanceof SetTreeNode$1) {
|
|
767
|
+
const xn = x2;
|
|
768
|
+
stack_mut = ofArrayWithTail([SetTreeNode$1__get_Left(xn), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(xn)), SetTreeNode$1__get_Right(xn)], rest);
|
|
769
|
+
continue SetTreeModule_collapseLHS;
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
return stack;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
stack_mut = rest;
|
|
777
|
+
continue SetTreeModule_collapseLHS;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
return empty_1();
|
|
782
|
+
}
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
export function SetTreeModule_mkIterator(s) {
|
|
787
|
+
return new SetTreeModule_SetIterator$1(SetTreeModule_collapseLHS(singleton_1(s)), false);
|
|
788
|
+
}
|
|
789
|
+
export function SetTreeModule_notStarted() {
|
|
790
|
+
throw new Error("Enumeration not started");
|
|
791
|
+
}
|
|
792
|
+
export function SetTreeModule_alreadyFinished() {
|
|
793
|
+
throw new Error("Enumeration already started");
|
|
794
|
+
}
|
|
795
|
+
export function SetTreeModule_current(i) {
|
|
796
|
+
if (i.started) {
|
|
797
|
+
const matchValue = i.stack;
|
|
798
|
+
if (isEmpty_1(matchValue)) {
|
|
799
|
+
return SetTreeModule_alreadyFinished();
|
|
800
|
+
}
|
|
801
|
+
else if (head(matchValue) != null) {
|
|
802
|
+
const t = value_3(head(matchValue));
|
|
803
|
+
return SetTreeLeaf$1__get_Key(t);
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
throw new Error("Please report error: Set iterator, unexpected stack for current");
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
return SetTreeModule_notStarted();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
export function SetTreeModule_moveNext(i) {
|
|
814
|
+
if (i.started) {
|
|
815
|
+
const matchValue = i.stack;
|
|
816
|
+
if (!isEmpty_1(matchValue)) {
|
|
817
|
+
if (head(matchValue) != null) {
|
|
818
|
+
const t = value_3(head(matchValue));
|
|
819
|
+
if (t instanceof SetTreeNode$1) {
|
|
820
|
+
throw new Error("Please report error: Set iterator, unexpected stack for moveNext");
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
i.stack = SetTreeModule_collapseLHS(tail(matchValue));
|
|
824
|
+
return !isEmpty_1(i.stack);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
else {
|
|
828
|
+
throw new Error("Please report error: Set iterator, unexpected stack for moveNext");
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
else {
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
else {
|
|
836
|
+
i.started = true;
|
|
837
|
+
return !isEmpty_1(i.stack);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
export function SetTreeModule_mkIEnumerator(s) {
|
|
841
|
+
let i = SetTreeModule_mkIterator(s);
|
|
842
|
+
return {
|
|
843
|
+
"System.Collections.Generic.IEnumerator`1.get_Current"() {
|
|
844
|
+
return SetTreeModule_current(i);
|
|
845
|
+
},
|
|
846
|
+
"System.Collections.IEnumerator.get_Current"() {
|
|
847
|
+
return SetTreeModule_current(i);
|
|
848
|
+
},
|
|
849
|
+
"System.Collections.IEnumerator.MoveNext"() {
|
|
850
|
+
return SetTreeModule_moveNext(i);
|
|
851
|
+
},
|
|
852
|
+
"System.Collections.IEnumerator.Reset"() {
|
|
853
|
+
i = SetTreeModule_mkIterator(s);
|
|
854
|
+
},
|
|
855
|
+
Dispose() {
|
|
856
|
+
},
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* Set comparison. Note this can be expensive.
|
|
861
|
+
*/
|
|
862
|
+
export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
863
|
+
SetTreeModule_compareStacks: while (true) {
|
|
864
|
+
const comparer = comparer_mut, l1 = l1_mut, l2 = l2_mut;
|
|
865
|
+
if (!isEmpty_1(l1)) {
|
|
866
|
+
if (!isEmpty_1(l2)) {
|
|
867
|
+
if (head(l2) != null) {
|
|
868
|
+
if (head(l1) != null) {
|
|
869
|
+
const x1_3 = value_3(head(l1));
|
|
870
|
+
const x2_3 = value_3(head(l2));
|
|
871
|
+
if (x1_3 instanceof SetTreeNode$1) {
|
|
872
|
+
const x1n_2 = x1_3;
|
|
873
|
+
if (SetTreeNode$1__get_Left(x1n_2) == null) {
|
|
874
|
+
if (x2_3 instanceof SetTreeNode$1) {
|
|
875
|
+
const x2n_2 = x2_3;
|
|
876
|
+
if (SetTreeNode$1__get_Left(x2n_2) == null) {
|
|
877
|
+
const c = comparer.Compare(SetTreeLeaf$1__get_Key(x1n_2), SetTreeLeaf$1__get_Key(x2n_2)) | 0;
|
|
878
|
+
if (c !== 0) {
|
|
879
|
+
return c | 0;
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
comparer_mut = comparer;
|
|
883
|
+
l1_mut = cons(SetTreeNode$1__get_Right(x1n_2), tail(l1));
|
|
884
|
+
l2_mut = cons(SetTreeNode$1__get_Right(x2n_2), tail(l2));
|
|
885
|
+
continue SetTreeModule_compareStacks;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
else {
|
|
889
|
+
let matchResult, t1_6, x1_4, t2_6, x2_4;
|
|
890
|
+
if (!isEmpty_1(l1)) {
|
|
891
|
+
if (head(l1) != null) {
|
|
892
|
+
matchResult = 0;
|
|
893
|
+
t1_6 = tail(l1);
|
|
894
|
+
x1_4 = value_3(head(l1));
|
|
895
|
+
}
|
|
896
|
+
else if (!isEmpty_1(l2)) {
|
|
897
|
+
if (head(l2) != null) {
|
|
898
|
+
matchResult = 1;
|
|
899
|
+
t2_6 = tail(l2);
|
|
900
|
+
x2_4 = value_3(head(l2));
|
|
901
|
+
}
|
|
902
|
+
else {
|
|
903
|
+
matchResult = 2;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
else {
|
|
907
|
+
matchResult = 2;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
else if (!isEmpty_1(l2)) {
|
|
911
|
+
if (head(l2) != null) {
|
|
912
|
+
matchResult = 1;
|
|
913
|
+
t2_6 = tail(l2);
|
|
914
|
+
x2_4 = value_3(head(l2));
|
|
915
|
+
}
|
|
916
|
+
else {
|
|
917
|
+
matchResult = 2;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
matchResult = 2;
|
|
922
|
+
}
|
|
923
|
+
switch (matchResult) {
|
|
924
|
+
case 0:
|
|
925
|
+
if (x1_4 instanceof SetTreeNode$1) {
|
|
926
|
+
const x1n_3 = x1_4;
|
|
927
|
+
comparer_mut = comparer;
|
|
928
|
+
l1_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x1n_3), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x1n_3), SetTreeModule_empty(), SetTreeNode$1__get_Right(x1n_3), 0)], t1_6);
|
|
929
|
+
l2_mut = l2;
|
|
930
|
+
continue SetTreeModule_compareStacks;
|
|
931
|
+
}
|
|
932
|
+
else {
|
|
933
|
+
comparer_mut = comparer;
|
|
934
|
+
l1_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x1_4))], t1_6);
|
|
935
|
+
l2_mut = l2;
|
|
936
|
+
continue SetTreeModule_compareStacks;
|
|
937
|
+
}
|
|
938
|
+
case 1:
|
|
939
|
+
if (x2_4 instanceof SetTreeNode$1) {
|
|
940
|
+
const x2n_3 = x2_4;
|
|
941
|
+
comparer_mut = comparer;
|
|
942
|
+
l1_mut = l1;
|
|
943
|
+
l2_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x2n_3), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x2n_3), SetTreeModule_empty(), SetTreeNode$1__get_Right(x2n_3), 0)], t2_6);
|
|
944
|
+
continue SetTreeModule_compareStacks;
|
|
945
|
+
}
|
|
946
|
+
else {
|
|
947
|
+
comparer_mut = comparer;
|
|
948
|
+
l1_mut = l1;
|
|
949
|
+
l2_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x2_4))], t2_6);
|
|
950
|
+
continue SetTreeModule_compareStacks;
|
|
951
|
+
}
|
|
952
|
+
default:
|
|
953
|
+
throw new Error("unexpected state in SetTree.compareStacks");
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
else {
|
|
958
|
+
const c_1 = comparer.Compare(SetTreeLeaf$1__get_Key(x1n_2), SetTreeLeaf$1__get_Key(x2_3)) | 0;
|
|
959
|
+
if (c_1 !== 0) {
|
|
960
|
+
return c_1 | 0;
|
|
961
|
+
}
|
|
962
|
+
else {
|
|
963
|
+
comparer_mut = comparer;
|
|
964
|
+
l1_mut = cons(SetTreeNode$1__get_Right(x1n_2), tail(l1));
|
|
965
|
+
l2_mut = cons(SetTreeModule_empty(), tail(l2));
|
|
966
|
+
continue SetTreeModule_compareStacks;
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
else {
|
|
971
|
+
let matchResult_1, t1_7, x1_5, t2_7, x2_5;
|
|
972
|
+
if (!isEmpty_1(l1)) {
|
|
973
|
+
if (head(l1) != null) {
|
|
974
|
+
matchResult_1 = 0;
|
|
975
|
+
t1_7 = tail(l1);
|
|
976
|
+
x1_5 = value_3(head(l1));
|
|
977
|
+
}
|
|
978
|
+
else if (!isEmpty_1(l2)) {
|
|
979
|
+
if (head(l2) != null) {
|
|
980
|
+
matchResult_1 = 1;
|
|
981
|
+
t2_7 = tail(l2);
|
|
982
|
+
x2_5 = value_3(head(l2));
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
matchResult_1 = 2;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
else {
|
|
989
|
+
matchResult_1 = 2;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
else if (!isEmpty_1(l2)) {
|
|
993
|
+
if (head(l2) != null) {
|
|
994
|
+
matchResult_1 = 1;
|
|
995
|
+
t2_7 = tail(l2);
|
|
996
|
+
x2_5 = value_3(head(l2));
|
|
997
|
+
}
|
|
998
|
+
else {
|
|
999
|
+
matchResult_1 = 2;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
matchResult_1 = 2;
|
|
1004
|
+
}
|
|
1005
|
+
switch (matchResult_1) {
|
|
1006
|
+
case 0:
|
|
1007
|
+
if (x1_5 instanceof SetTreeNode$1) {
|
|
1008
|
+
const x1n_4 = x1_5;
|
|
1009
|
+
comparer_mut = comparer;
|
|
1010
|
+
l1_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x1n_4), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x1n_4), SetTreeModule_empty(), SetTreeNode$1__get_Right(x1n_4), 0)], t1_7);
|
|
1011
|
+
l2_mut = l2;
|
|
1012
|
+
continue SetTreeModule_compareStacks;
|
|
1013
|
+
}
|
|
1014
|
+
else {
|
|
1015
|
+
comparer_mut = comparer;
|
|
1016
|
+
l1_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x1_5))], t1_7);
|
|
1017
|
+
l2_mut = l2;
|
|
1018
|
+
continue SetTreeModule_compareStacks;
|
|
1019
|
+
}
|
|
1020
|
+
case 1:
|
|
1021
|
+
if (x2_5 instanceof SetTreeNode$1) {
|
|
1022
|
+
const x2n_4 = x2_5;
|
|
1023
|
+
comparer_mut = comparer;
|
|
1024
|
+
l1_mut = l1;
|
|
1025
|
+
l2_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x2n_4), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x2n_4), SetTreeModule_empty(), SetTreeNode$1__get_Right(x2n_4), 0)], t2_7);
|
|
1026
|
+
continue SetTreeModule_compareStacks;
|
|
1027
|
+
}
|
|
1028
|
+
else {
|
|
1029
|
+
comparer_mut = comparer;
|
|
1030
|
+
l1_mut = l1;
|
|
1031
|
+
l2_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x2_5))], t2_7);
|
|
1032
|
+
continue SetTreeModule_compareStacks;
|
|
1033
|
+
}
|
|
1034
|
+
default:
|
|
1035
|
+
throw new Error("unexpected state in SetTree.compareStacks");
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
else if (x2_3 instanceof SetTreeNode$1) {
|
|
1040
|
+
const x2n_5 = x2_3;
|
|
1041
|
+
if (SetTreeNode$1__get_Left(x2n_5) == null) {
|
|
1042
|
+
const c_2 = comparer.Compare(SetTreeLeaf$1__get_Key(x1_3), SetTreeLeaf$1__get_Key(x2n_5)) | 0;
|
|
1043
|
+
if (c_2 !== 0) {
|
|
1044
|
+
return c_2 | 0;
|
|
1045
|
+
}
|
|
1046
|
+
else {
|
|
1047
|
+
comparer_mut = comparer;
|
|
1048
|
+
l1_mut = cons(SetTreeModule_empty(), tail(l1));
|
|
1049
|
+
l2_mut = cons(SetTreeNode$1__get_Right(x2n_5), tail(l2));
|
|
1050
|
+
continue SetTreeModule_compareStacks;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
else {
|
|
1054
|
+
let matchResult_2, t1_8, x1_6, t2_8, x2_6;
|
|
1055
|
+
if (!isEmpty_1(l1)) {
|
|
1056
|
+
if (head(l1) != null) {
|
|
1057
|
+
matchResult_2 = 0;
|
|
1058
|
+
t1_8 = tail(l1);
|
|
1059
|
+
x1_6 = value_3(head(l1));
|
|
1060
|
+
}
|
|
1061
|
+
else if (!isEmpty_1(l2)) {
|
|
1062
|
+
if (head(l2) != null) {
|
|
1063
|
+
matchResult_2 = 1;
|
|
1064
|
+
t2_8 = tail(l2);
|
|
1065
|
+
x2_6 = value_3(head(l2));
|
|
1066
|
+
}
|
|
1067
|
+
else {
|
|
1068
|
+
matchResult_2 = 2;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
matchResult_2 = 2;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
else if (!isEmpty_1(l2)) {
|
|
1076
|
+
if (head(l2) != null) {
|
|
1077
|
+
matchResult_2 = 1;
|
|
1078
|
+
t2_8 = tail(l2);
|
|
1079
|
+
x2_6 = value_3(head(l2));
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
matchResult_2 = 2;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
else {
|
|
1086
|
+
matchResult_2 = 2;
|
|
1087
|
+
}
|
|
1088
|
+
switch (matchResult_2) {
|
|
1089
|
+
case 0:
|
|
1090
|
+
if (x1_6 instanceof SetTreeNode$1) {
|
|
1091
|
+
const x1n_5 = x1_6;
|
|
1092
|
+
comparer_mut = comparer;
|
|
1093
|
+
l1_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x1n_5), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x1n_5), SetTreeModule_empty(), SetTreeNode$1__get_Right(x1n_5), 0)], t1_8);
|
|
1094
|
+
l2_mut = l2;
|
|
1095
|
+
continue SetTreeModule_compareStacks;
|
|
1096
|
+
}
|
|
1097
|
+
else {
|
|
1098
|
+
comparer_mut = comparer;
|
|
1099
|
+
l1_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x1_6))], t1_8);
|
|
1100
|
+
l2_mut = l2;
|
|
1101
|
+
continue SetTreeModule_compareStacks;
|
|
1102
|
+
}
|
|
1103
|
+
case 1:
|
|
1104
|
+
if (x2_6 instanceof SetTreeNode$1) {
|
|
1105
|
+
const x2n_6 = x2_6;
|
|
1106
|
+
comparer_mut = comparer;
|
|
1107
|
+
l1_mut = l1;
|
|
1108
|
+
l2_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x2n_6), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x2n_6), SetTreeModule_empty(), SetTreeNode$1__get_Right(x2n_6), 0)], t2_8);
|
|
1109
|
+
continue SetTreeModule_compareStacks;
|
|
1110
|
+
}
|
|
1111
|
+
else {
|
|
1112
|
+
comparer_mut = comparer;
|
|
1113
|
+
l1_mut = l1;
|
|
1114
|
+
l2_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x2_6))], t2_8);
|
|
1115
|
+
continue SetTreeModule_compareStacks;
|
|
1116
|
+
}
|
|
1117
|
+
default:
|
|
1118
|
+
throw new Error("unexpected state in SetTree.compareStacks");
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
else {
|
|
1123
|
+
const c_3 = comparer.Compare(SetTreeLeaf$1__get_Key(x1_3), SetTreeLeaf$1__get_Key(x2_3)) | 0;
|
|
1124
|
+
if (c_3 !== 0) {
|
|
1125
|
+
return c_3 | 0;
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
comparer_mut = comparer;
|
|
1129
|
+
l1_mut = tail(l1);
|
|
1130
|
+
l2_mut = tail(l2);
|
|
1131
|
+
continue SetTreeModule_compareStacks;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
const x2 = value_3(head(l2));
|
|
1137
|
+
let matchResult_3, t1_2, x1, t2_2, x2_1;
|
|
1138
|
+
if (!isEmpty_1(l1)) {
|
|
1139
|
+
if (head(l1) != null) {
|
|
1140
|
+
matchResult_3 = 0;
|
|
1141
|
+
t1_2 = tail(l1);
|
|
1142
|
+
x1 = value_3(head(l1));
|
|
1143
|
+
}
|
|
1144
|
+
else if (!isEmpty_1(l2)) {
|
|
1145
|
+
if (head(l2) != null) {
|
|
1146
|
+
matchResult_3 = 1;
|
|
1147
|
+
t2_2 = tail(l2);
|
|
1148
|
+
x2_1 = value_3(head(l2));
|
|
1149
|
+
}
|
|
1150
|
+
else {
|
|
1151
|
+
matchResult_3 = 2;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
else {
|
|
1155
|
+
matchResult_3 = 2;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
else if (!isEmpty_1(l2)) {
|
|
1159
|
+
if (head(l2) != null) {
|
|
1160
|
+
matchResult_3 = 1;
|
|
1161
|
+
t2_2 = tail(l2);
|
|
1162
|
+
x2_1 = value_3(head(l2));
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
matchResult_3 = 2;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
else {
|
|
1169
|
+
matchResult_3 = 2;
|
|
1170
|
+
}
|
|
1171
|
+
switch (matchResult_3) {
|
|
1172
|
+
case 0:
|
|
1173
|
+
if (x1 instanceof SetTreeNode$1) {
|
|
1174
|
+
const x1n = x1;
|
|
1175
|
+
comparer_mut = comparer;
|
|
1176
|
+
l1_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x1n), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x1n), SetTreeModule_empty(), SetTreeNode$1__get_Right(x1n), 0)], t1_2);
|
|
1177
|
+
l2_mut = l2;
|
|
1178
|
+
continue SetTreeModule_compareStacks;
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
comparer_mut = comparer;
|
|
1182
|
+
l1_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x1))], t1_2);
|
|
1183
|
+
l2_mut = l2;
|
|
1184
|
+
continue SetTreeModule_compareStacks;
|
|
1185
|
+
}
|
|
1186
|
+
case 1:
|
|
1187
|
+
if (x2_1 instanceof SetTreeNode$1) {
|
|
1188
|
+
const x2n = x2_1;
|
|
1189
|
+
comparer_mut = comparer;
|
|
1190
|
+
l1_mut = l1;
|
|
1191
|
+
l2_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x2n), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x2n), SetTreeModule_empty(), SetTreeNode$1__get_Right(x2n), 0)], t2_2);
|
|
1192
|
+
continue SetTreeModule_compareStacks;
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
comparer_mut = comparer;
|
|
1196
|
+
l1_mut = l1;
|
|
1197
|
+
l2_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x2_1))], t2_2);
|
|
1198
|
+
continue SetTreeModule_compareStacks;
|
|
1199
|
+
}
|
|
1200
|
+
default:
|
|
1201
|
+
throw new Error("unexpected state in SetTree.compareStacks");
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
else if (head(l1) != null) {
|
|
1206
|
+
const x1_1 = value_3(head(l1));
|
|
1207
|
+
let matchResult_4, t1_4, x1_2, t2_4, x2_2;
|
|
1208
|
+
if (!isEmpty_1(l1)) {
|
|
1209
|
+
if (head(l1) != null) {
|
|
1210
|
+
matchResult_4 = 0;
|
|
1211
|
+
t1_4 = tail(l1);
|
|
1212
|
+
x1_2 = value_3(head(l1));
|
|
1213
|
+
}
|
|
1214
|
+
else if (!isEmpty_1(l2)) {
|
|
1215
|
+
if (head(l2) != null) {
|
|
1216
|
+
matchResult_4 = 1;
|
|
1217
|
+
t2_4 = tail(l2);
|
|
1218
|
+
x2_2 = value_3(head(l2));
|
|
1219
|
+
}
|
|
1220
|
+
else {
|
|
1221
|
+
matchResult_4 = 2;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
else {
|
|
1225
|
+
matchResult_4 = 2;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
else if (!isEmpty_1(l2)) {
|
|
1229
|
+
if (head(l2) != null) {
|
|
1230
|
+
matchResult_4 = 1;
|
|
1231
|
+
t2_4 = tail(l2);
|
|
1232
|
+
x2_2 = value_3(head(l2));
|
|
1233
|
+
}
|
|
1234
|
+
else {
|
|
1235
|
+
matchResult_4 = 2;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
else {
|
|
1239
|
+
matchResult_4 = 2;
|
|
1240
|
+
}
|
|
1241
|
+
switch (matchResult_4) {
|
|
1242
|
+
case 0:
|
|
1243
|
+
if (x1_2 instanceof SetTreeNode$1) {
|
|
1244
|
+
const x1n_1 = x1_2;
|
|
1245
|
+
comparer_mut = comparer;
|
|
1246
|
+
l1_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x1n_1), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x1n_1), SetTreeModule_empty(), SetTreeNode$1__get_Right(x1n_1), 0)], t1_4);
|
|
1247
|
+
l2_mut = l2;
|
|
1248
|
+
continue SetTreeModule_compareStacks;
|
|
1249
|
+
}
|
|
1250
|
+
else {
|
|
1251
|
+
comparer_mut = comparer;
|
|
1252
|
+
l1_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x1_2))], t1_4);
|
|
1253
|
+
l2_mut = l2;
|
|
1254
|
+
continue SetTreeModule_compareStacks;
|
|
1255
|
+
}
|
|
1256
|
+
case 1:
|
|
1257
|
+
if (x2_2 instanceof SetTreeNode$1) {
|
|
1258
|
+
const x2n_1 = x2_2;
|
|
1259
|
+
comparer_mut = comparer;
|
|
1260
|
+
l1_mut = l1;
|
|
1261
|
+
l2_mut = ofArrayWithTail([SetTreeNode$1__get_Left(x2n_1), SetTreeNode$1_$ctor_5F465FC9(SetTreeLeaf$1__get_Key(x2n_1), SetTreeModule_empty(), SetTreeNode$1__get_Right(x2n_1), 0)], t2_4);
|
|
1262
|
+
continue SetTreeModule_compareStacks;
|
|
1263
|
+
}
|
|
1264
|
+
else {
|
|
1265
|
+
comparer_mut = comparer;
|
|
1266
|
+
l1_mut = l1;
|
|
1267
|
+
l2_mut = ofArrayWithTail([SetTreeModule_empty(), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(x2_2))], t2_4);
|
|
1268
|
+
continue SetTreeModule_compareStacks;
|
|
1269
|
+
}
|
|
1270
|
+
default:
|
|
1271
|
+
throw new Error("unexpected state in SetTree.compareStacks");
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
else {
|
|
1275
|
+
comparer_mut = comparer;
|
|
1276
|
+
l1_mut = tail(l1);
|
|
1277
|
+
l2_mut = tail(l2);
|
|
1278
|
+
continue SetTreeModule_compareStacks;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
else {
|
|
1282
|
+
return 1;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
else if (isEmpty_1(l2)) {
|
|
1286
|
+
return 0;
|
|
1287
|
+
}
|
|
1288
|
+
else {
|
|
1289
|
+
return -1;
|
|
1290
|
+
}
|
|
1291
|
+
break;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
export function SetTreeModule_compare(comparer, t1, t2) {
|
|
1295
|
+
if (t1 == null) {
|
|
1296
|
+
if (t2 == null) {
|
|
1297
|
+
return 0;
|
|
1298
|
+
}
|
|
1299
|
+
else {
|
|
1300
|
+
return -1;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
else if (t2 == null) {
|
|
1304
|
+
return 1;
|
|
1305
|
+
}
|
|
1306
|
+
else {
|
|
1307
|
+
return SetTreeModule_compareStacks(comparer, singleton_1(t1), singleton_1(t2)) | 0;
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
export function SetTreeModule_choose(s) {
|
|
1311
|
+
return SetTreeModule_minimumElement(s);
|
|
1312
|
+
}
|
|
1313
|
+
export function SetTreeModule_toList(t) {
|
|
1314
|
+
const loop = (t$0027_mut, acc_mut) => {
|
|
1315
|
+
loop: while (true) {
|
|
1316
|
+
const t$0027 = t$0027_mut, acc = acc_mut;
|
|
1317
|
+
if (t$0027 != null) {
|
|
1318
|
+
const t2 = value_3(t$0027);
|
|
1319
|
+
if (t2 instanceof SetTreeNode$1) {
|
|
1320
|
+
const tn = t2;
|
|
1321
|
+
t$0027_mut = SetTreeNode$1__get_Left(tn);
|
|
1322
|
+
acc_mut = cons(SetTreeLeaf$1__get_Key(tn), loop(SetTreeNode$1__get_Right(tn), acc));
|
|
1323
|
+
continue loop;
|
|
1324
|
+
}
|
|
1325
|
+
else {
|
|
1326
|
+
return cons(SetTreeLeaf$1__get_Key(t2), acc);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
else {
|
|
1330
|
+
return acc;
|
|
1331
|
+
}
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
return loop(t, empty_1());
|
|
1336
|
+
}
|
|
1337
|
+
export function SetTreeModule_copyToArray(s, arr, i) {
|
|
1338
|
+
let j = i;
|
|
1339
|
+
SetTreeModule_iter((x) => {
|
|
1340
|
+
setItem(arr, j, x);
|
|
1341
|
+
j = ((j + 1) | 0);
|
|
1342
|
+
}, s);
|
|
1343
|
+
}
|
|
1344
|
+
export function SetTreeModule_toArray(s) {
|
|
1345
|
+
const n = SetTreeModule_count(s) | 0;
|
|
1346
|
+
const res = fill(new Array(n), 0, n, null);
|
|
1347
|
+
SetTreeModule_copyToArray(s, res, 0);
|
|
1348
|
+
return res;
|
|
1349
|
+
}
|
|
1350
|
+
export function SetTreeModule_mkFromEnumerator(comparer_mut, acc_mut, e_mut) {
|
|
1351
|
+
SetTreeModule_mkFromEnumerator: while (true) {
|
|
1352
|
+
const comparer = comparer_mut, acc = acc_mut, e = e_mut;
|
|
1353
|
+
if (e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1354
|
+
comparer_mut = comparer;
|
|
1355
|
+
acc_mut = SetTreeModule_add(comparer, e["System.Collections.Generic.IEnumerator`1.get_Current"](), acc);
|
|
1356
|
+
e_mut = e;
|
|
1357
|
+
continue SetTreeModule_mkFromEnumerator;
|
|
1358
|
+
}
|
|
1359
|
+
else {
|
|
1360
|
+
return acc;
|
|
1361
|
+
}
|
|
1362
|
+
break;
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
export function SetTreeModule_ofArray(comparer, l) {
|
|
1366
|
+
return fold_1((acc, k) => SetTreeModule_add(comparer, k, acc), SetTreeModule_empty(), l);
|
|
1367
|
+
}
|
|
1368
|
+
export function SetTreeModule_ofList(comparer, l) {
|
|
1369
|
+
return fold_2((acc, k) => SetTreeModule_add(comparer, k, acc), SetTreeModule_empty(), l);
|
|
1370
|
+
}
|
|
1371
|
+
export function SetTreeModule_ofSeq(comparer, c) {
|
|
1372
|
+
if (isArrayLike(c)) {
|
|
1373
|
+
return SetTreeModule_ofArray(comparer, c);
|
|
1374
|
+
}
|
|
1375
|
+
else if (c instanceof FSharpList) {
|
|
1376
|
+
return SetTreeModule_ofList(comparer, c);
|
|
1377
|
+
}
|
|
1378
|
+
else {
|
|
1379
|
+
const ie = getEnumerator(c);
|
|
1380
|
+
try {
|
|
1381
|
+
return SetTreeModule_mkFromEnumerator(comparer, SetTreeModule_empty(), ie);
|
|
1382
|
+
}
|
|
1383
|
+
finally {
|
|
1384
|
+
disposeSafe(ie);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
export class FSharpSet {
|
|
1389
|
+
constructor(comparer, tree) {
|
|
1390
|
+
this.comparer = comparer;
|
|
1391
|
+
this.tree = tree;
|
|
1392
|
+
}
|
|
1393
|
+
GetHashCode() {
|
|
1394
|
+
const this$ = this;
|
|
1395
|
+
return FSharpSet__ComputeHashCode(this$) | 0;
|
|
1396
|
+
}
|
|
1397
|
+
Equals(that) {
|
|
1398
|
+
let that_1;
|
|
1399
|
+
const this$ = this;
|
|
1400
|
+
return (that instanceof FSharpSet) && ((that_1 = that, SetTreeModule_compare(FSharpSet__get_Comparer(this$), FSharpSet__get_Tree(this$), FSharpSet__get_Tree(that_1)) === 0));
|
|
1401
|
+
}
|
|
1402
|
+
toString() {
|
|
1403
|
+
const this$ = this;
|
|
1404
|
+
return ("set [" + join("; ", map_1((x) => {
|
|
1405
|
+
let copyOfStruct = x;
|
|
1406
|
+
return toString(copyOfStruct);
|
|
1407
|
+
}, this$))) + "]";
|
|
1408
|
+
}
|
|
1409
|
+
get [Symbol.toStringTag]() {
|
|
1410
|
+
return "FSharpSet";
|
|
1411
|
+
}
|
|
1412
|
+
toJSON() {
|
|
1413
|
+
const this$ = this;
|
|
1414
|
+
return Array.from(this$);
|
|
1415
|
+
}
|
|
1416
|
+
CompareTo(that) {
|
|
1417
|
+
const s = this;
|
|
1418
|
+
return SetTreeModule_compare(FSharpSet__get_Comparer(s), FSharpSet__get_Tree(s), FSharpSet__get_Tree(that)) | 0;
|
|
1419
|
+
}
|
|
1420
|
+
"System.Collections.Generic.ICollection`1.Add2B595"(x) {
|
|
1421
|
+
throw new Error("ReadOnlyCollection");
|
|
1422
|
+
}
|
|
1423
|
+
"System.Collections.Generic.ICollection`1.Clear"() {
|
|
1424
|
+
throw new Error("ReadOnlyCollection");
|
|
1425
|
+
}
|
|
1426
|
+
"System.Collections.Generic.ICollection`1.Remove2B595"(x) {
|
|
1427
|
+
throw new Error("ReadOnlyCollection");
|
|
1428
|
+
}
|
|
1429
|
+
"System.Collections.Generic.ICollection`1.Contains2B595"(x) {
|
|
1430
|
+
const s = this;
|
|
1431
|
+
return SetTreeModule_mem(FSharpSet__get_Comparer(s), x, FSharpSet__get_Tree(s));
|
|
1432
|
+
}
|
|
1433
|
+
"System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"(arr, i) {
|
|
1434
|
+
const s = this;
|
|
1435
|
+
SetTreeModule_copyToArray(FSharpSet__get_Tree(s), arr, i);
|
|
1436
|
+
}
|
|
1437
|
+
"System.Collections.Generic.ICollection`1.get_IsReadOnly"() {
|
|
1438
|
+
return true;
|
|
1439
|
+
}
|
|
1440
|
+
"System.Collections.Generic.ICollection`1.get_Count"() {
|
|
1441
|
+
const s = this;
|
|
1442
|
+
return FSharpSet__get_Count(s) | 0;
|
|
1443
|
+
}
|
|
1444
|
+
"System.Collections.Generic.IReadOnlyCollection`1.get_Count"() {
|
|
1445
|
+
const s = this;
|
|
1446
|
+
return FSharpSet__get_Count(s) | 0;
|
|
1447
|
+
}
|
|
1448
|
+
GetEnumerator() {
|
|
1449
|
+
const s = this;
|
|
1450
|
+
return SetTreeModule_mkIEnumerator(FSharpSet__get_Tree(s));
|
|
1451
|
+
}
|
|
1452
|
+
[Symbol.iterator]() {
|
|
1453
|
+
return toIterator(getEnumerator(this));
|
|
1454
|
+
}
|
|
1455
|
+
"System.Collections.IEnumerable.GetEnumerator"() {
|
|
1456
|
+
const s = this;
|
|
1457
|
+
return SetTreeModule_mkIEnumerator(FSharpSet__get_Tree(s));
|
|
1458
|
+
}
|
|
1459
|
+
get size() {
|
|
1460
|
+
const s = this;
|
|
1461
|
+
return FSharpSet__get_Count(s) | 0;
|
|
1462
|
+
}
|
|
1463
|
+
add(k) {
|
|
1464
|
+
const s = this;
|
|
1465
|
+
throw new Error("Set cannot be mutated");
|
|
1466
|
+
return s;
|
|
1467
|
+
}
|
|
1468
|
+
clear() {
|
|
1469
|
+
throw new Error("Set cannot be mutated");
|
|
1470
|
+
}
|
|
1471
|
+
delete(k) {
|
|
1472
|
+
throw new Error("Set cannot be mutated");
|
|
1473
|
+
return false;
|
|
1474
|
+
}
|
|
1475
|
+
has(k) {
|
|
1476
|
+
const s = this;
|
|
1477
|
+
return FSharpSet__Contains(s, k);
|
|
1478
|
+
}
|
|
1479
|
+
keys() {
|
|
1480
|
+
const s = this;
|
|
1481
|
+
return map_1((x) => x, s);
|
|
1482
|
+
}
|
|
1483
|
+
values() {
|
|
1484
|
+
const s = this;
|
|
1485
|
+
return map_1((x) => x, s);
|
|
1486
|
+
}
|
|
1487
|
+
entries() {
|
|
1488
|
+
const s = this;
|
|
1489
|
+
return map_1((v) => [v, v], s);
|
|
1490
|
+
}
|
|
1491
|
+
forEach(f, thisArg) {
|
|
1492
|
+
const s = this;
|
|
1493
|
+
iterate_1((x) => {
|
|
1494
|
+
f(x, x, s);
|
|
1495
|
+
}, s);
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
export function FSharpSet_$reflection(gen0) {
|
|
1499
|
+
return class_type("Set.FSharpSet", [gen0], FSharpSet);
|
|
1500
|
+
}
|
|
1501
|
+
export function FSharpSet_$ctor(comparer, tree) {
|
|
1502
|
+
return new FSharpSet(comparer, tree);
|
|
1503
|
+
}
|
|
1504
|
+
export function FSharpSet__get_Comparer(set$) {
|
|
1505
|
+
return set$.comparer;
|
|
1506
|
+
}
|
|
1507
|
+
export function FSharpSet__get_Tree(set$) {
|
|
1508
|
+
return set$.tree;
|
|
1509
|
+
}
|
|
1510
|
+
export function FSharpSet_Empty(comparer) {
|
|
1511
|
+
return FSharpSet_$ctor(comparer, SetTreeModule_empty());
|
|
1512
|
+
}
|
|
1513
|
+
export function FSharpSet__Add(s, value) {
|
|
1514
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(s), SetTreeModule_add(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s)));
|
|
1515
|
+
}
|
|
1516
|
+
export function FSharpSet__Remove(s, value) {
|
|
1517
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(s), SetTreeModule_remove(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s)));
|
|
1518
|
+
}
|
|
1519
|
+
export function FSharpSet__get_Count(s) {
|
|
1520
|
+
return SetTreeModule_count(FSharpSet__get_Tree(s));
|
|
1521
|
+
}
|
|
1522
|
+
export function FSharpSet__Contains(s, value) {
|
|
1523
|
+
return SetTreeModule_mem(FSharpSet__get_Comparer(s), value, FSharpSet__get_Tree(s));
|
|
1524
|
+
}
|
|
1525
|
+
export function FSharpSet__Iterate(s, x) {
|
|
1526
|
+
SetTreeModule_iter(x, FSharpSet__get_Tree(s));
|
|
1527
|
+
}
|
|
1528
|
+
export function FSharpSet__Fold(s, f, z) {
|
|
1529
|
+
const f_1 = f;
|
|
1530
|
+
return SetTreeModule_fold((x, z_1) => f_1(z_1, x), z, FSharpSet__get_Tree(s));
|
|
1531
|
+
}
|
|
1532
|
+
export function FSharpSet__get_IsEmpty(s) {
|
|
1533
|
+
return FSharpSet__get_Tree(s) == null;
|
|
1534
|
+
}
|
|
1535
|
+
export function FSharpSet__Partition(s, f) {
|
|
1536
|
+
if (FSharpSet__get_Tree(s) == null) {
|
|
1537
|
+
return [s, s];
|
|
1538
|
+
}
|
|
1539
|
+
else {
|
|
1540
|
+
const patternInput = SetTreeModule_partition(FSharpSet__get_Comparer(s), f, FSharpSet__get_Tree(s));
|
|
1541
|
+
return [FSharpSet_$ctor(FSharpSet__get_Comparer(s), patternInput[0]), FSharpSet_$ctor(FSharpSet__get_Comparer(s), patternInput[1])];
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
export function FSharpSet__Filter(s, f) {
|
|
1545
|
+
if (FSharpSet__get_Tree(s) == null) {
|
|
1546
|
+
return s;
|
|
1547
|
+
}
|
|
1548
|
+
else {
|
|
1549
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(s), SetTreeModule_filter(FSharpSet__get_Comparer(s), f, FSharpSet__get_Tree(s)));
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
export function FSharpSet__Map(s, f, comparer) {
|
|
1553
|
+
return FSharpSet_$ctor(comparer, SetTreeModule_fold((acc, k) => SetTreeModule_add(comparer, f(k), acc), SetTreeModule_empty(), FSharpSet__get_Tree(s)));
|
|
1554
|
+
}
|
|
1555
|
+
export function FSharpSet__Exists(s, f) {
|
|
1556
|
+
return SetTreeModule_exists(f, FSharpSet__get_Tree(s));
|
|
1557
|
+
}
|
|
1558
|
+
export function FSharpSet__ForAll(s, f) {
|
|
1559
|
+
return SetTreeModule_forall(f, FSharpSet__get_Tree(s));
|
|
1560
|
+
}
|
|
1561
|
+
export function FSharpSet_op_Subtraction(set1, set2) {
|
|
1562
|
+
if (FSharpSet__get_Tree(set1) == null) {
|
|
1563
|
+
return set1;
|
|
1564
|
+
}
|
|
1565
|
+
else if (FSharpSet__get_Tree(set2) == null) {
|
|
1566
|
+
return set1;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(set1), SetTreeModule_diff(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2)));
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
export function FSharpSet_op_Addition(set1, set2) {
|
|
1573
|
+
if (FSharpSet__get_Tree(set2) == null) {
|
|
1574
|
+
return set1;
|
|
1575
|
+
}
|
|
1576
|
+
else if (FSharpSet__get_Tree(set1) == null) {
|
|
1577
|
+
return set2;
|
|
1578
|
+
}
|
|
1579
|
+
else {
|
|
1580
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(set1), SetTreeModule_union(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2)));
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
export function FSharpSet_Intersection(a, b) {
|
|
1584
|
+
if (FSharpSet__get_Tree(b) == null) {
|
|
1585
|
+
return b;
|
|
1586
|
+
}
|
|
1587
|
+
else if (FSharpSet__get_Tree(a) == null) {
|
|
1588
|
+
return a;
|
|
1589
|
+
}
|
|
1590
|
+
else {
|
|
1591
|
+
return FSharpSet_$ctor(FSharpSet__get_Comparer(a), SetTreeModule_intersection(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b)));
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
export function FSharpSet_IntersectionMany(sets) {
|
|
1595
|
+
return reduce(FSharpSet_Intersection, sets);
|
|
1596
|
+
}
|
|
1597
|
+
export function FSharpSet_Equality(a, b) {
|
|
1598
|
+
return SetTreeModule_compare(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b)) === 0;
|
|
1599
|
+
}
|
|
1600
|
+
export function FSharpSet_Compare(a, b) {
|
|
1601
|
+
return SetTreeModule_compare(FSharpSet__get_Comparer(a), FSharpSet__get_Tree(a), FSharpSet__get_Tree(b));
|
|
1602
|
+
}
|
|
1603
|
+
export function FSharpSet__get_Choose(x) {
|
|
1604
|
+
return SetTreeModule_choose(FSharpSet__get_Tree(x));
|
|
1605
|
+
}
|
|
1606
|
+
export function FSharpSet__get_MinimumElement(x) {
|
|
1607
|
+
return SetTreeModule_minimumElement(FSharpSet__get_Tree(x));
|
|
1608
|
+
}
|
|
1609
|
+
export function FSharpSet__get_MaximumElement(x) {
|
|
1610
|
+
return SetTreeModule_maximumElement(FSharpSet__get_Tree(x));
|
|
1611
|
+
}
|
|
1612
|
+
export function FSharpSet__IsSubsetOf(x, otherSet) {
|
|
1613
|
+
return SetTreeModule_subset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(x), FSharpSet__get_Tree(otherSet));
|
|
1614
|
+
}
|
|
1615
|
+
export function FSharpSet__IsSupersetOf(x, otherSet) {
|
|
1616
|
+
return SetTreeModule_subset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(otherSet), FSharpSet__get_Tree(x));
|
|
1617
|
+
}
|
|
1618
|
+
export function FSharpSet__IsProperSubsetOf(x, otherSet) {
|
|
1619
|
+
return SetTreeModule_properSubset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(x), FSharpSet__get_Tree(otherSet));
|
|
1620
|
+
}
|
|
1621
|
+
export function FSharpSet__IsProperSupersetOf(x, otherSet) {
|
|
1622
|
+
return SetTreeModule_properSubset(FSharpSet__get_Comparer(x), FSharpSet__get_Tree(otherSet), FSharpSet__get_Tree(x));
|
|
1623
|
+
}
|
|
1624
|
+
export function FSharpSet__ToList(x) {
|
|
1625
|
+
return SetTreeModule_toList(FSharpSet__get_Tree(x));
|
|
1626
|
+
}
|
|
1627
|
+
export function FSharpSet__ToArray(x) {
|
|
1628
|
+
return SetTreeModule_toArray(FSharpSet__get_Tree(x));
|
|
1629
|
+
}
|
|
1630
|
+
export function FSharpSet__ComputeHashCode(this$) {
|
|
1631
|
+
let res = 0;
|
|
1632
|
+
const enumerator = getEnumerator(this$);
|
|
1633
|
+
try {
|
|
1634
|
+
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1635
|
+
const x_1 = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
1636
|
+
res = ((((res << 1) + structuralHash(x_1)) + 631) | 0);
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
finally {
|
|
1640
|
+
disposeSafe(enumerator);
|
|
1641
|
+
}
|
|
1642
|
+
return Math.abs(res) | 0;
|
|
1643
|
+
}
|
|
1644
|
+
export function isEmpty(set$) {
|
|
1645
|
+
return FSharpSet__get_IsEmpty(set$);
|
|
1646
|
+
}
|
|
1647
|
+
export function contains(element, set$) {
|
|
1648
|
+
return FSharpSet__Contains(set$, element);
|
|
1649
|
+
}
|
|
1650
|
+
export function add(value, set$) {
|
|
1651
|
+
return FSharpSet__Add(set$, value);
|
|
1652
|
+
}
|
|
1653
|
+
export function singleton(value, comparer) {
|
|
1654
|
+
return FSharpSet__Add(FSharpSet_Empty(comparer), value);
|
|
1655
|
+
}
|
|
1656
|
+
export function remove(value, set$) {
|
|
1657
|
+
return FSharpSet__Remove(set$, value);
|
|
1658
|
+
}
|
|
1659
|
+
export function union(set1, set2) {
|
|
1660
|
+
return FSharpSet_op_Addition(set1, set2);
|
|
1661
|
+
}
|
|
1662
|
+
export function unionMany(sets, comparer) {
|
|
1663
|
+
return fold_3(FSharpSet_op_Addition, FSharpSet_Empty(comparer), sets);
|
|
1664
|
+
}
|
|
1665
|
+
export function intersect(set1, set2) {
|
|
1666
|
+
return FSharpSet_Intersection(set1, set2);
|
|
1667
|
+
}
|
|
1668
|
+
export function intersectMany(sets) {
|
|
1669
|
+
return FSharpSet_IntersectionMany(sets);
|
|
1670
|
+
}
|
|
1671
|
+
export function iterate(action, set$) {
|
|
1672
|
+
FSharpSet__Iterate(set$, action);
|
|
1673
|
+
}
|
|
1674
|
+
export function empty(comparer) {
|
|
1675
|
+
return FSharpSet_Empty(comparer);
|
|
1676
|
+
}
|
|
1677
|
+
export function forAll(predicate, set$) {
|
|
1678
|
+
return FSharpSet__ForAll(set$, predicate);
|
|
1679
|
+
}
|
|
1680
|
+
export function exists(predicate, set$) {
|
|
1681
|
+
return FSharpSet__Exists(set$, predicate);
|
|
1682
|
+
}
|
|
1683
|
+
export function filter(predicate, set$) {
|
|
1684
|
+
return FSharpSet__Filter(set$, predicate);
|
|
1685
|
+
}
|
|
1686
|
+
export function partition(predicate, set$) {
|
|
1687
|
+
return FSharpSet__Partition(set$, predicate);
|
|
1688
|
+
}
|
|
1689
|
+
export function fold(folder, state, set$) {
|
|
1690
|
+
return SetTreeModule_fold(folder, state, FSharpSet__get_Tree(set$));
|
|
1691
|
+
}
|
|
1692
|
+
export function foldBack(folder, set$, state) {
|
|
1693
|
+
return SetTreeModule_foldBack(folder, FSharpSet__get_Tree(set$), state);
|
|
1694
|
+
}
|
|
1695
|
+
export function map(mapping, set$, comparer) {
|
|
1696
|
+
return FSharpSet__Map(set$, mapping, comparer);
|
|
1697
|
+
}
|
|
1698
|
+
export function count(set$) {
|
|
1699
|
+
return FSharpSet__get_Count(set$);
|
|
1700
|
+
}
|
|
1701
|
+
export function ofList(elements, comparer) {
|
|
1702
|
+
return FSharpSet_$ctor(comparer, SetTreeModule_ofSeq(comparer, elements));
|
|
1703
|
+
}
|
|
1704
|
+
export function ofArray(array, comparer) {
|
|
1705
|
+
return FSharpSet_$ctor(comparer, SetTreeModule_ofArray(comparer, array));
|
|
1706
|
+
}
|
|
1707
|
+
export function toList(set$) {
|
|
1708
|
+
return FSharpSet__ToList(set$);
|
|
1709
|
+
}
|
|
1710
|
+
export function toArray(set$) {
|
|
1711
|
+
return FSharpSet__ToArray(set$);
|
|
1712
|
+
}
|
|
1713
|
+
export function toSeq(set$) {
|
|
1714
|
+
return map_1((x) => x, set$);
|
|
1715
|
+
}
|
|
1716
|
+
export function ofSeq(elements, comparer) {
|
|
1717
|
+
return FSharpSet_$ctor(comparer, SetTreeModule_ofSeq(comparer, elements));
|
|
1718
|
+
}
|
|
1719
|
+
export function difference(set1, set2) {
|
|
1720
|
+
return FSharpSet_op_Subtraction(set1, set2);
|
|
1721
|
+
}
|
|
1722
|
+
export function isSubset(set1, set2) {
|
|
1723
|
+
return SetTreeModule_subset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2));
|
|
1724
|
+
}
|
|
1725
|
+
export function isSuperset(set1, set2) {
|
|
1726
|
+
return SetTreeModule_subset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set2), FSharpSet__get_Tree(set1));
|
|
1727
|
+
}
|
|
1728
|
+
export function isProperSubset(set1, set2) {
|
|
1729
|
+
return SetTreeModule_properSubset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set1), FSharpSet__get_Tree(set2));
|
|
1730
|
+
}
|
|
1731
|
+
export function isProperSuperset(set1, set2) {
|
|
1732
|
+
return SetTreeModule_properSubset(FSharpSet__get_Comparer(set1), FSharpSet__get_Tree(set2), FSharpSet__get_Tree(set1));
|
|
1733
|
+
}
|
|
1734
|
+
export function minElement(set$) {
|
|
1735
|
+
return FSharpSet__get_MinimumElement(set$);
|
|
1736
|
+
}
|
|
1737
|
+
export function maxElement(set$) {
|
|
1738
|
+
return FSharpSet__get_MaximumElement(set$);
|
|
1739
|
+
}
|
|
1740
|
+
export function unionWith(s1, s2) {
|
|
1741
|
+
return fold_3((acc, x) => acc.add(x), s1, s2);
|
|
1742
|
+
}
|
|
1743
|
+
export function newMutableSetWith(s1, s2) {
|
|
1744
|
+
if (s1 instanceof HashSet) {
|
|
1745
|
+
const s1_1 = s1;
|
|
1746
|
+
return HashSet_$ctor_Z6150332D(s2, HashSet__get_Comparer(s1_1));
|
|
1747
|
+
}
|
|
1748
|
+
else {
|
|
1749
|
+
return new Set(s2);
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
export function intersectWith(s1, s2) {
|
|
1753
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1754
|
+
iterate_1((x) => {
|
|
1755
|
+
if (!s2_1.has(x)) {
|
|
1756
|
+
s1.delete(x);
|
|
1757
|
+
}
|
|
1758
|
+
}, s1.values());
|
|
1759
|
+
}
|
|
1760
|
+
export function exceptWith(s1, s2) {
|
|
1761
|
+
iterate_1((x) => {
|
|
1762
|
+
s1.delete(x);
|
|
1763
|
+
}, s2);
|
|
1764
|
+
}
|
|
1765
|
+
export function isSubsetOf(s1, s2) {
|
|
1766
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1767
|
+
return forAll_1((value) => s2_1.has(value), s1.values());
|
|
1768
|
+
}
|
|
1769
|
+
export function isSupersetOf(s1, s2) {
|
|
1770
|
+
return forAll_1((value) => s1.has(value), s2);
|
|
1771
|
+
}
|
|
1772
|
+
export function isProperSubsetOf(s1, s2) {
|
|
1773
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1774
|
+
if (s2_1.size > s1.size) {
|
|
1775
|
+
return forAll_1((value) => s2_1.has(value), s1.values());
|
|
1776
|
+
}
|
|
1777
|
+
else {
|
|
1778
|
+
return false;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
export function isProperSupersetOf(s1, s2) {
|
|
1782
|
+
const s2_1 = cache(s2);
|
|
1783
|
+
if (exists_1((arg) => !s1.has(arg), s2_1)) {
|
|
1784
|
+
return forAll_1((value_2) => s1.has(value_2), s2_1);
|
|
1785
|
+
}
|
|
1786
|
+
else {
|
|
1787
|
+
return false;
|
|
1788
|
+
}
|
|
1789
|
+
}
|