compostjs 0.0.8 → 0.0.12
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/README.md +4 -4
- 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 +6 -5
- package/.claude/settings.local.json +0 -11
- 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
|
@@ -1,1234 +0,0 @@
|
|
|
1
|
-
import { defaultArg, value as value$$1, some } from "./Option";
|
|
2
|
-
import { List } from "./Types";
|
|
3
|
-
import { transpose as transpose$$1, pairwise as pairwise$$1, collect as collect$$1, scanBack as scanBack$$1, scan as scan$$1, foldBack2 as foldBack2$$1, fold2 as fold2$$1, fold as fold$$1, map as map$$1 } from "./Seq";
|
|
4
|
-
import { getItemFromDict, addToDict, tryGetValue, addToSet, count } from "./Util";
|
|
5
|
-
import { ofList } from "./Array";
|
|
6
|
-
import { splitInto as splitInto$$1, chunkBySize as chunkBySize$$1, permute as permute$$1, findIndexBack as findIndexBack$$1, tryFindIndexBack as tryFindIndexBack$$1 } from "./Array";
|
|
7
|
-
import { createMutable } from "./Set";
|
|
8
|
-
import { createMutable as createMutable$$1 } from "./Map";
|
|
9
|
-
export function head(_arg1) {
|
|
10
|
-
if (_arg1.tail != null) {
|
|
11
|
-
return _arg1.head;
|
|
12
|
-
} else {
|
|
13
|
-
throw new Error("List was empty");
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
export function tryHead(_arg1$$1) {
|
|
17
|
-
if (_arg1$$1.tail != null) {
|
|
18
|
-
return some(_arg1$$1.head);
|
|
19
|
-
} else {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export function tail(_arg1$$2) {
|
|
24
|
-
if (_arg1$$2.tail != null) {
|
|
25
|
-
return _arg1$$2.tail;
|
|
26
|
-
} else {
|
|
27
|
-
throw new Error("List was empty");
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export function last($_arg1$$3$$5) {
|
|
31
|
-
last: while (true) {
|
|
32
|
-
const _arg1$$3 = $_arg1$$3$$5;
|
|
33
|
-
|
|
34
|
-
if (_arg1$$3.tail != null) {
|
|
35
|
-
if (_arg1$$3.tail.tail == null) {
|
|
36
|
-
return _arg1$$3.head;
|
|
37
|
-
} else {
|
|
38
|
-
$_arg1$$3$$5 = _arg1$$3.tail;
|
|
39
|
-
continue last;
|
|
40
|
-
}
|
|
41
|
-
} else {
|
|
42
|
-
throw new Error("List was empty");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export function tryLast($_arg1$$4$$6) {
|
|
49
|
-
tryLast: while (true) {
|
|
50
|
-
const _arg1$$4 = $_arg1$$4$$6;
|
|
51
|
-
|
|
52
|
-
if (_arg1$$4.tail != null) {
|
|
53
|
-
if (_arg1$$4.tail.tail == null) {
|
|
54
|
-
return some(_arg1$$4.head);
|
|
55
|
-
} else {
|
|
56
|
-
$_arg1$$4$$6 = _arg1$$4.tail;
|
|
57
|
-
continue tryLast;
|
|
58
|
-
}
|
|
59
|
-
} else {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export function compareWith(comparer, xs$$3, ys) {
|
|
67
|
-
if (xs$$3 === ys) {
|
|
68
|
-
return 0;
|
|
69
|
-
} else {
|
|
70
|
-
const loop = function loop($xs$$4$$10, $ys$$1$$11) {
|
|
71
|
-
loop: while (true) {
|
|
72
|
-
const xs$$4 = $xs$$4$$10,
|
|
73
|
-
ys$$1 = $ys$$1$$11;
|
|
74
|
-
|
|
75
|
-
if (xs$$4.tail != null) {
|
|
76
|
-
if (ys$$1.tail != null) {
|
|
77
|
-
const matchValue$$1 = comparer(xs$$4.head, ys$$1.head) | 0;
|
|
78
|
-
|
|
79
|
-
if (matchValue$$1 === 0) {
|
|
80
|
-
$xs$$4$$10 = xs$$4.tail;
|
|
81
|
-
$ys$$1$$11 = ys$$1.tail;
|
|
82
|
-
continue loop;
|
|
83
|
-
} else {
|
|
84
|
-
return matchValue$$1 | 0;
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
return 1;
|
|
88
|
-
}
|
|
89
|
-
} else if (ys$$1.tail == null) {
|
|
90
|
-
return 0;
|
|
91
|
-
} else {
|
|
92
|
-
return -1 | 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
return loop(xs$$3, ys) | 0;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
export function foldIndexedAux($f$$12, $i$$13, $acc$$14, $_arg1$$5$$15) {
|
|
103
|
-
foldIndexedAux: while (true) {
|
|
104
|
-
const f = $f$$12,
|
|
105
|
-
i = $i$$13,
|
|
106
|
-
acc = $acc$$14,
|
|
107
|
-
_arg1$$5 = $_arg1$$5$$15;
|
|
108
|
-
|
|
109
|
-
if (_arg1$$5.tail != null) {
|
|
110
|
-
$f$$12 = f;
|
|
111
|
-
$i$$13 = i + 1;
|
|
112
|
-
$acc$$14 = f(i, acc, _arg1$$5.head);
|
|
113
|
-
$_arg1$$5$$15 = _arg1$$5.tail;
|
|
114
|
-
continue foldIndexedAux;
|
|
115
|
-
} else {
|
|
116
|
-
return acc;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
export function foldIndexed(f$$1, state, xs$$7) {
|
|
123
|
-
return foldIndexedAux(f$$1, 0, state, xs$$7);
|
|
124
|
-
}
|
|
125
|
-
export function fold($f$$2$$19, $state$$1$$20, $xs$$8$$21) {
|
|
126
|
-
fold: while (true) {
|
|
127
|
-
const f$$2 = $f$$2$$19,
|
|
128
|
-
state$$1 = $state$$1$$20,
|
|
129
|
-
xs$$8 = $xs$$8$$21;
|
|
130
|
-
|
|
131
|
-
if (xs$$8.tail != null) {
|
|
132
|
-
$f$$2$$19 = f$$2;
|
|
133
|
-
$state$$1$$20 = f$$2(state$$1, xs$$8.head);
|
|
134
|
-
$xs$$8$$21 = xs$$8.tail;
|
|
135
|
-
continue fold;
|
|
136
|
-
} else {
|
|
137
|
-
return state$$1;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
export function reverse(xs$$9) {
|
|
144
|
-
return fold(function (acc$$1, x$$6) {
|
|
145
|
-
return new List(x$$6, acc$$1);
|
|
146
|
-
}, new List(), xs$$9);
|
|
147
|
-
}
|
|
148
|
-
export function foldBack(f$$3, xs$$10, state$$2) {
|
|
149
|
-
return fold(function (acc$$2, x$$7) {
|
|
150
|
-
return f$$3(x$$7, acc$$2);
|
|
151
|
-
}, state$$2, reverse(xs$$10));
|
|
152
|
-
}
|
|
153
|
-
export function toSeq(xs$$11) {
|
|
154
|
-
return map$$1(function (x$$8) {
|
|
155
|
-
return x$$8;
|
|
156
|
-
}, xs$$11);
|
|
157
|
-
}
|
|
158
|
-
export function ofSeq(xs$$12) {
|
|
159
|
-
const xs$$13 = fold$$1(function (acc$$3, x$$9) {
|
|
160
|
-
return new List(x$$9, acc$$3);
|
|
161
|
-
}, new List(), xs$$12);
|
|
162
|
-
return reverse(xs$$13);
|
|
163
|
-
}
|
|
164
|
-
export function concat(lists) {
|
|
165
|
-
const xs$$15 = fold$$1(function (state$$3, xs$$14) {
|
|
166
|
-
return fold(function f$$4(acc$$4, x$$10) {
|
|
167
|
-
return new List(x$$10, acc$$4);
|
|
168
|
-
}, state$$3, xs$$14);
|
|
169
|
-
}, new List(), lists);
|
|
170
|
-
return reverse(xs$$15);
|
|
171
|
-
}
|
|
172
|
-
export function foldIndexed2Aux($f$$5$$31, $i$$1$$32, $acc$$5$$33, $bs$$34, $cs$$35) {
|
|
173
|
-
foldIndexed2Aux: while (true) {
|
|
174
|
-
const f$$5 = $f$$5$$31,
|
|
175
|
-
i$$1 = $i$$1$$32,
|
|
176
|
-
acc$$5 = $acc$$5$$33,
|
|
177
|
-
bs = $bs$$34,
|
|
178
|
-
cs = $cs$$35;
|
|
179
|
-
var $target$$36, x$$11, xs$$16, y$$1, ys$$3;
|
|
180
|
-
|
|
181
|
-
if (bs.tail != null) {
|
|
182
|
-
if (cs.tail != null) {
|
|
183
|
-
$target$$36 = 1;
|
|
184
|
-
x$$11 = bs.head;
|
|
185
|
-
xs$$16 = bs.tail;
|
|
186
|
-
y$$1 = cs.head;
|
|
187
|
-
ys$$3 = cs.tail;
|
|
188
|
-
} else {
|
|
189
|
-
$target$$36 = 2;
|
|
190
|
-
}
|
|
191
|
-
} else if (cs.tail == null) {
|
|
192
|
-
$target$$36 = 0;
|
|
193
|
-
} else {
|
|
194
|
-
$target$$36 = 2;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
switch ($target$$36) {
|
|
198
|
-
case 0:
|
|
199
|
-
{
|
|
200
|
-
return acc$$5;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
case 1:
|
|
204
|
-
{
|
|
205
|
-
$f$$5$$31 = f$$5;
|
|
206
|
-
$i$$1$$32 = i$$1 + 1;
|
|
207
|
-
$acc$$5$$33 = f$$5(i$$1, acc$$5, x$$11, y$$1);
|
|
208
|
-
$bs$$34 = xs$$16;
|
|
209
|
-
$cs$$35 = ys$$3;
|
|
210
|
-
continue foldIndexed2Aux;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
case 2:
|
|
214
|
-
{
|
|
215
|
-
throw new Error("Lists had different lengths");
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
export function foldIndexed2(f$$6, state$$4, xs$$17, ys$$4) {
|
|
223
|
-
return foldIndexed2Aux(f$$6, 0, state$$4, xs$$17, ys$$4);
|
|
224
|
-
}
|
|
225
|
-
export function fold2(f$$7, state$$5, xs$$18, ys$$5) {
|
|
226
|
-
return fold2$$1(f$$7, state$$5, xs$$18, ys$$5);
|
|
227
|
-
}
|
|
228
|
-
export function foldBack2(f$$8, xs$$19, ys$$6, state$$6) {
|
|
229
|
-
return foldBack2$$1(f$$8, xs$$19, ys$$6, state$$6);
|
|
230
|
-
}
|
|
231
|
-
export function unfold(f$$9, state$$7) {
|
|
232
|
-
const unfoldInner = function unfoldInner($acc$$6$$51, $state$$8$$52) {
|
|
233
|
-
unfoldInner: while (true) {
|
|
234
|
-
const acc$$6 = $acc$$6$$51,
|
|
235
|
-
state$$8 = $state$$8$$52;
|
|
236
|
-
const matchValue$$3 = f$$9(state$$8);
|
|
237
|
-
|
|
238
|
-
if (matchValue$$3 != null) {
|
|
239
|
-
const x$$12 = matchValue$$3[0];
|
|
240
|
-
const state$$9 = matchValue$$3[1];
|
|
241
|
-
$acc$$6$$51 = new List(x$$12, acc$$6);
|
|
242
|
-
$state$$8$$52 = state$$9;
|
|
243
|
-
continue unfoldInner;
|
|
244
|
-
} else {
|
|
245
|
-
return reverse(acc$$6);
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
break;
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
return unfoldInner(new List(), state$$7);
|
|
253
|
-
}
|
|
254
|
-
export function foldIndexed3Aux($f$$10$$53, $i$$2$$54, $acc$$7$$55, $bs$$1$$56, $cs$$1$$57, $ds$$58) {
|
|
255
|
-
foldIndexed3Aux: while (true) {
|
|
256
|
-
const f$$10 = $f$$10$$53,
|
|
257
|
-
i$$2 = $i$$2$$54,
|
|
258
|
-
acc$$7 = $acc$$7$$55,
|
|
259
|
-
bs$$1 = $bs$$1$$56,
|
|
260
|
-
cs$$1 = $cs$$1$$57,
|
|
261
|
-
ds = $ds$$58;
|
|
262
|
-
var $target$$59, x$$13, xs$$20, y$$2, ys$$7, z, zs;
|
|
263
|
-
|
|
264
|
-
if (bs$$1.tail != null) {
|
|
265
|
-
if (cs$$1.tail != null) {
|
|
266
|
-
if (ds.tail != null) {
|
|
267
|
-
$target$$59 = 1;
|
|
268
|
-
x$$13 = bs$$1.head;
|
|
269
|
-
xs$$20 = bs$$1.tail;
|
|
270
|
-
y$$2 = cs$$1.head;
|
|
271
|
-
ys$$7 = cs$$1.tail;
|
|
272
|
-
z = ds.head;
|
|
273
|
-
zs = ds.tail;
|
|
274
|
-
} else {
|
|
275
|
-
$target$$59 = 2;
|
|
276
|
-
}
|
|
277
|
-
} else {
|
|
278
|
-
$target$$59 = 2;
|
|
279
|
-
}
|
|
280
|
-
} else if (cs$$1.tail == null) {
|
|
281
|
-
if (ds.tail == null) {
|
|
282
|
-
$target$$59 = 0;
|
|
283
|
-
} else {
|
|
284
|
-
$target$$59 = 2;
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
$target$$59 = 2;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
switch ($target$$59) {
|
|
291
|
-
case 0:
|
|
292
|
-
{
|
|
293
|
-
return acc$$7;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
case 1:
|
|
297
|
-
{
|
|
298
|
-
$f$$10$$53 = f$$10;
|
|
299
|
-
$i$$2$$54 = i$$2 + 1;
|
|
300
|
-
$acc$$7$$55 = f$$10(i$$2, acc$$7, x$$13, y$$2, z);
|
|
301
|
-
$bs$$1$$56 = xs$$20;
|
|
302
|
-
$cs$$1$$57 = ys$$7;
|
|
303
|
-
$ds$$58 = zs;
|
|
304
|
-
continue foldIndexed3Aux;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
case 2:
|
|
308
|
-
{
|
|
309
|
-
throw new Error("Lists had different lengths");
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
export function foldIndexed3(f$$11, seed, xs$$21, ys$$8, zs$$1) {
|
|
317
|
-
return foldIndexed3Aux(f$$11, 0, seed, xs$$21, ys$$8, zs$$1);
|
|
318
|
-
}
|
|
319
|
-
export function fold3(f$$12, state$$10, xs$$22, ys$$9, zs$$2) {
|
|
320
|
-
return foldIndexed3(function (_arg1$$6, acc$$8, x$$14, y$$3, z$$1) {
|
|
321
|
-
return f$$12(acc$$8, x$$14, y$$3, z$$1);
|
|
322
|
-
}, state$$10, xs$$22, ys$$9, zs$$2);
|
|
323
|
-
}
|
|
324
|
-
export function scan(f$$13, state$$11, xs$$23) {
|
|
325
|
-
const xs$$24 = scan$$1(f$$13, state$$11, xs$$23);
|
|
326
|
-
return ofSeq(xs$$24);
|
|
327
|
-
}
|
|
328
|
-
export function scanBack(f$$14, xs$$25, state$$12) {
|
|
329
|
-
const xs$$26 = scanBack$$1(f$$14, xs$$25, state$$12);
|
|
330
|
-
return ofSeq(xs$$26);
|
|
331
|
-
}
|
|
332
|
-
export function length(xs$$27) {
|
|
333
|
-
return fold(function (acc$$9, _arg1$$7) {
|
|
334
|
-
return acc$$9 + 1;
|
|
335
|
-
}, 0, xs$$27);
|
|
336
|
-
}
|
|
337
|
-
export function append(xs$$28, ys$$10) {
|
|
338
|
-
return fold(function (acc$$10, x$$15) {
|
|
339
|
-
return new List(x$$15, acc$$10);
|
|
340
|
-
}, ys$$10, reverse(xs$$28));
|
|
341
|
-
}
|
|
342
|
-
export function collect(f$$15, xs$$29) {
|
|
343
|
-
const xs$$30 = collect$$1(f$$15, xs$$29);
|
|
344
|
-
return ofSeq(xs$$30);
|
|
345
|
-
}
|
|
346
|
-
export function map(f$$16, xs$$31) {
|
|
347
|
-
const xs$$32 = fold(function (acc$$11, x$$16) {
|
|
348
|
-
return new List(f$$16(x$$16), acc$$11);
|
|
349
|
-
}, new List(), xs$$31);
|
|
350
|
-
return reverse(xs$$32);
|
|
351
|
-
}
|
|
352
|
-
export function mapIndexed(f$$17, xs$$33) {
|
|
353
|
-
const xs$$34 = foldIndexed(function (i$$3, acc$$12, x$$17) {
|
|
354
|
-
return new List(f$$17(i$$3, x$$17), acc$$12);
|
|
355
|
-
}, new List(), xs$$33);
|
|
356
|
-
return reverse(xs$$34);
|
|
357
|
-
}
|
|
358
|
-
export function indexed(xs$$35) {
|
|
359
|
-
return mapIndexed(function (i$$4, x$$18) {
|
|
360
|
-
return [i$$4, x$$18];
|
|
361
|
-
}, xs$$35);
|
|
362
|
-
}
|
|
363
|
-
export function map2(f$$18, xs$$36, ys$$11) {
|
|
364
|
-
const xs$$37 = fold2(function (acc$$13, x$$19, y$$4) {
|
|
365
|
-
return new List(f$$18(x$$19, y$$4), acc$$13);
|
|
366
|
-
}, new List(), xs$$36, ys$$11);
|
|
367
|
-
return reverse(xs$$37);
|
|
368
|
-
}
|
|
369
|
-
export function mapIndexed2(f$$19, xs$$38, ys$$12) {
|
|
370
|
-
const xs$$39 = foldIndexed2(function (i$$5, acc$$14, x$$20, y$$5) {
|
|
371
|
-
return new List(f$$19(i$$5, x$$20, y$$5), acc$$14);
|
|
372
|
-
}, new List(), xs$$38, ys$$12);
|
|
373
|
-
return reverse(xs$$39);
|
|
374
|
-
}
|
|
375
|
-
export function map3(f$$20, xs$$40, ys$$13, zs$$3) {
|
|
376
|
-
const xs$$41 = fold3(function (acc$$15, x$$21, y$$6, z$$2) {
|
|
377
|
-
return new List(f$$20(x$$21, y$$6, z$$2), acc$$15);
|
|
378
|
-
}, new List(), xs$$40, ys$$13, zs$$3);
|
|
379
|
-
return reverse(xs$$41);
|
|
380
|
-
}
|
|
381
|
-
export function mapIndexed3(f$$21, xs$$42, ys$$14, zs$$4) {
|
|
382
|
-
const xs$$43 = foldIndexed3(function (i$$6, acc$$16, x$$22, y$$7, z$$3) {
|
|
383
|
-
return new List(f$$21(i$$6, x$$22, y$$7, z$$3), acc$$16);
|
|
384
|
-
}, new List(), xs$$42, ys$$14, zs$$4);
|
|
385
|
-
return reverse(xs$$43);
|
|
386
|
-
}
|
|
387
|
-
export function mapFold(f$$22, s, xs$$44) {
|
|
388
|
-
const patternInput$$1 = fold(function foldFn(tupledArg, x$$23) {
|
|
389
|
-
const patternInput = f$$22(tupledArg[1], x$$23);
|
|
390
|
-
return [new List(patternInput[0], tupledArg[0]), patternInput[1]];
|
|
391
|
-
}, [new List(), s], xs$$44);
|
|
392
|
-
return [reverse(patternInput$$1[0]), patternInput$$1[1]];
|
|
393
|
-
}
|
|
394
|
-
export function mapFoldBack(f$$23, xs$$45, s$$2) {
|
|
395
|
-
return mapFold(function (s$$3, v) {
|
|
396
|
-
return f$$23(v, s$$3);
|
|
397
|
-
}, s$$2, reverse(xs$$45));
|
|
398
|
-
}
|
|
399
|
-
export function iterate(f$$24, xs$$46) {
|
|
400
|
-
fold(function (unitVar0, x$$24) {
|
|
401
|
-
f$$24(x$$24);
|
|
402
|
-
}, void null, xs$$46);
|
|
403
|
-
}
|
|
404
|
-
export function iterate2(f$$25, xs$$47, ys$$15) {
|
|
405
|
-
fold2(function (unitVar0$$1, x$$25, y$$8) {
|
|
406
|
-
f$$25(x$$25, y$$8);
|
|
407
|
-
}, void null, xs$$47, ys$$15);
|
|
408
|
-
}
|
|
409
|
-
export function iterateIndexed(f$$26, xs$$48) {
|
|
410
|
-
foldIndexed(function (i$$7, unitVar1, x$$26) {
|
|
411
|
-
f$$26(i$$7, x$$26);
|
|
412
|
-
}, void null, xs$$48);
|
|
413
|
-
}
|
|
414
|
-
export function iterateIndexed2(f$$27, xs$$49, ys$$16) {
|
|
415
|
-
foldIndexed2(function (i$$8, unitVar1$$1, x$$27, y$$9) {
|
|
416
|
-
f$$27(i$$8, x$$27, y$$9);
|
|
417
|
-
}, void null, xs$$49, ys$$16);
|
|
418
|
-
}
|
|
419
|
-
export function ofArray(xs$$50) {
|
|
420
|
-
let res$$1 = new List();
|
|
421
|
-
|
|
422
|
-
for (let i$$9 = count(xs$$50) - 1; i$$9 >= 0; i$$9--) {
|
|
423
|
-
res$$1 = new List(xs$$50[i$$9], res$$1);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return res$$1;
|
|
427
|
-
}
|
|
428
|
-
export function empty() {
|
|
429
|
-
return new List();
|
|
430
|
-
}
|
|
431
|
-
export function isEmpty(_arg1$$8) {
|
|
432
|
-
if (_arg1$$8.tail == null) {
|
|
433
|
-
return true;
|
|
434
|
-
} else {
|
|
435
|
-
return false;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
export function tryPickIndexedAux($f$$28$$120, $i$$10$$121, $_arg1$$9$$122) {
|
|
439
|
-
tryPickIndexedAux: while (true) {
|
|
440
|
-
const f$$28 = $f$$28$$120,
|
|
441
|
-
i$$10 = $i$$10$$121,
|
|
442
|
-
_arg1$$9 = $_arg1$$9$$122;
|
|
443
|
-
|
|
444
|
-
if (_arg1$$9.tail != null) {
|
|
445
|
-
const result = f$$28(i$$10, _arg1$$9.head);
|
|
446
|
-
|
|
447
|
-
if (result == null) {
|
|
448
|
-
$f$$28$$120 = f$$28;
|
|
449
|
-
$i$$10$$121 = i$$10 + 1;
|
|
450
|
-
$_arg1$$9$$122 = _arg1$$9.tail;
|
|
451
|
-
continue tryPickIndexedAux;
|
|
452
|
-
} else {
|
|
453
|
-
return result;
|
|
454
|
-
}
|
|
455
|
-
} else {
|
|
456
|
-
return undefined;
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
break;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
export function tryPickIndexed(f$$29, xs$$52) {
|
|
463
|
-
return tryPickIndexedAux(f$$29, 0, xs$$52);
|
|
464
|
-
}
|
|
465
|
-
export function tryPick(f$$30, xs$$53) {
|
|
466
|
-
return tryPickIndexed(function (_arg1$$10, x$$29) {
|
|
467
|
-
return f$$30(x$$29);
|
|
468
|
-
}, xs$$53);
|
|
469
|
-
}
|
|
470
|
-
export function pick(f$$31, xs$$54) {
|
|
471
|
-
const matchValue$$5 = tryPick(f$$31, xs$$54);
|
|
472
|
-
|
|
473
|
-
if (matchValue$$5 != null) {
|
|
474
|
-
const x$$30 = value$$1(matchValue$$5);
|
|
475
|
-
return x$$30;
|
|
476
|
-
} else {
|
|
477
|
-
throw new Error("List did not contain any matching elements");
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
export function tryFindIndexed(f$$32, xs$$55) {
|
|
481
|
-
return tryPickIndexed(function (i$$11, x$$31) {
|
|
482
|
-
return f$$32(i$$11, x$$31) ? some(x$$31) : undefined;
|
|
483
|
-
}, xs$$55);
|
|
484
|
-
}
|
|
485
|
-
export function tryFind(f$$33, xs$$56) {
|
|
486
|
-
return tryPickIndexed(function (_arg1$$11, x$$32) {
|
|
487
|
-
return f$$33(x$$32) ? some(x$$32) : undefined;
|
|
488
|
-
}, xs$$56);
|
|
489
|
-
}
|
|
490
|
-
export function findIndexed(f$$34, xs$$57) {
|
|
491
|
-
const matchValue$$6 = tryFindIndexed(f$$34, xs$$57);
|
|
492
|
-
|
|
493
|
-
if (matchValue$$6 != null) {
|
|
494
|
-
const x$$33 = value$$1(matchValue$$6);
|
|
495
|
-
return x$$33;
|
|
496
|
-
} else {
|
|
497
|
-
throw new Error("List did not contain any matching elements");
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
export function find(f$$35, xs$$58) {
|
|
501
|
-
return findIndexed(function (_arg1$$12, x$$34) {
|
|
502
|
-
return f$$35(x$$34);
|
|
503
|
-
}, xs$$58);
|
|
504
|
-
}
|
|
505
|
-
export function findBack(f$$36, xs$$59) {
|
|
506
|
-
let xs$$61;
|
|
507
|
-
xs$$61 = reverse(xs$$59);
|
|
508
|
-
return find(f$$36, xs$$61);
|
|
509
|
-
}
|
|
510
|
-
export function tryFindBack(f$$37, xs$$62) {
|
|
511
|
-
let xs$$64;
|
|
512
|
-
xs$$64 = reverse(xs$$62);
|
|
513
|
-
return tryFind(f$$37, xs$$64);
|
|
514
|
-
}
|
|
515
|
-
export function tryFindIndex(f$$38, xs$$65) {
|
|
516
|
-
return tryPickIndexed(function (i$$12, x$$35) {
|
|
517
|
-
return f$$38(x$$35) ? i$$12 : undefined;
|
|
518
|
-
}, xs$$65);
|
|
519
|
-
}
|
|
520
|
-
export function tryFindIndexBack(f$$39, xs$$66) {
|
|
521
|
-
const array = ofList(xs$$66, Array);
|
|
522
|
-
return tryFindIndexBack$$1(f$$39, array);
|
|
523
|
-
}
|
|
524
|
-
export function findIndex(f$$40, xs$$67) {
|
|
525
|
-
const matchValue$$7 = tryFindIndex(f$$40, xs$$67);
|
|
526
|
-
|
|
527
|
-
if (matchValue$$7 != null) {
|
|
528
|
-
const x$$36 = matchValue$$7 | 0;
|
|
529
|
-
return x$$36 | 0;
|
|
530
|
-
} else {
|
|
531
|
-
throw new Error("List did not contain any matching elements");
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
export function findIndexBack(f$$41, xs$$68) {
|
|
535
|
-
const array$$1 = ofList(xs$$68, Array);
|
|
536
|
-
return findIndexBack$$1(f$$41, array$$1) | 0;
|
|
537
|
-
}
|
|
538
|
-
export function item(n, xs$$69) {
|
|
539
|
-
return findIndexed(function (i$$13, _arg1$$13) {
|
|
540
|
-
return n === i$$13;
|
|
541
|
-
}, xs$$69);
|
|
542
|
-
}
|
|
543
|
-
export function tryItem(n$$1, xs$$70) {
|
|
544
|
-
return tryFindIndexed(function (i$$14, _arg1$$14) {
|
|
545
|
-
return n$$1 === i$$14;
|
|
546
|
-
}, xs$$70);
|
|
547
|
-
}
|
|
548
|
-
export function filter(f$$42, xs$$71) {
|
|
549
|
-
const xs$$72 = fold(function (acc$$17, x$$37) {
|
|
550
|
-
return f$$42(x$$37) ? new List(x$$37, acc$$17) : acc$$17;
|
|
551
|
-
}, new List(), xs$$71);
|
|
552
|
-
return reverse(xs$$72);
|
|
553
|
-
}
|
|
554
|
-
export function partition(f$$43, xs$$73) {
|
|
555
|
-
return fold(function (tupledArg$$1, x$$38) {
|
|
556
|
-
return f$$43(x$$38) ? [new List(x$$38, tupledArg$$1[0]), tupledArg$$1[1]] : [tupledArg$$1[0], new List(x$$38, tupledArg$$1[1])];
|
|
557
|
-
}, [new List(), new List()], reverse(xs$$73));
|
|
558
|
-
}
|
|
559
|
-
export function choose(f$$44, xs$$74) {
|
|
560
|
-
const xs$$75 = fold(function (acc$$18, x$$39) {
|
|
561
|
-
const matchValue$$8 = f$$44(x$$39);
|
|
562
|
-
|
|
563
|
-
if (matchValue$$8 == null) {
|
|
564
|
-
return acc$$18;
|
|
565
|
-
} else {
|
|
566
|
-
const y$$10 = value$$1(matchValue$$8);
|
|
567
|
-
return new List(y$$10, acc$$18);
|
|
568
|
-
}
|
|
569
|
-
}, new List(), xs$$74);
|
|
570
|
-
return reverse(xs$$75);
|
|
571
|
-
}
|
|
572
|
-
export function contains(value, list, eq) {
|
|
573
|
-
const loop$$1 = function loop$$1($xs$$76$$162) {
|
|
574
|
-
loop$$1: while (true) {
|
|
575
|
-
const xs$$76 = $xs$$76$$162;
|
|
576
|
-
|
|
577
|
-
if (xs$$76.tail != null) {
|
|
578
|
-
if (eq.Equals(value, xs$$76.head)) {
|
|
579
|
-
return true;
|
|
580
|
-
} else {
|
|
581
|
-
$xs$$76$$162 = xs$$76.tail;
|
|
582
|
-
continue loop$$1;
|
|
583
|
-
}
|
|
584
|
-
} else {
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
break;
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
|
|
592
|
-
return loop$$1(list);
|
|
593
|
-
}
|
|
594
|
-
export function except(itemsToExclude, array$$2, eq$$1) {
|
|
595
|
-
if (isEmpty(array$$2)) {
|
|
596
|
-
return array$$2;
|
|
597
|
-
} else {
|
|
598
|
-
const cached = createMutable(itemsToExclude, eq$$1);
|
|
599
|
-
return filter(function f$$45(arg00) {
|
|
600
|
-
return addToSet(arg00, cached);
|
|
601
|
-
}, array$$2);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
export function initialize(n$$2, f$$46) {
|
|
605
|
-
let xs$$78 = new List();
|
|
606
|
-
|
|
607
|
-
for (let i$$15 = 0; i$$15 <= n$$2 - 1; i$$15++) {
|
|
608
|
-
xs$$78 = new List(f$$46(i$$15), xs$$78);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
return reverse(xs$$78);
|
|
612
|
-
}
|
|
613
|
-
export function replicate(n$$3, x$$40) {
|
|
614
|
-
return initialize(n$$3, function (_arg1$$15) {
|
|
615
|
-
return x$$40;
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
export function reduce(f$$47, _arg1$$16) {
|
|
619
|
-
if (_arg1$$16.tail != null) {
|
|
620
|
-
return fold(f$$47, _arg1$$16.head, _arg1$$16.tail);
|
|
621
|
-
} else {
|
|
622
|
-
throw new Error("List was empty");
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
export function reduceBack(f$$48, _arg1$$17) {
|
|
626
|
-
if (_arg1$$17.tail != null) {
|
|
627
|
-
return foldBack(f$$48, _arg1$$17.tail, _arg1$$17.head);
|
|
628
|
-
} else {
|
|
629
|
-
throw new Error("List was empty");
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
export function forAll(f$$49, xs$$79) {
|
|
633
|
-
return fold(function (acc$$19, x$$41) {
|
|
634
|
-
return acc$$19 ? f$$49(x$$41) : false;
|
|
635
|
-
}, true, xs$$79);
|
|
636
|
-
}
|
|
637
|
-
export function forAll2(f$$50, xs$$80, ys$$17) {
|
|
638
|
-
return fold2(function (acc$$20, x$$42, y$$11) {
|
|
639
|
-
return acc$$20 ? f$$50(x$$42, y$$11) : false;
|
|
640
|
-
}, true, xs$$80, ys$$17);
|
|
641
|
-
}
|
|
642
|
-
export function exists($f$$51$$180, $_arg1$$18$$181) {
|
|
643
|
-
exists: while (true) {
|
|
644
|
-
const f$$51 = $f$$51$$180,
|
|
645
|
-
_arg1$$18 = $_arg1$$18$$181;
|
|
646
|
-
|
|
647
|
-
if (_arg1$$18.tail != null) {
|
|
648
|
-
if (f$$51(_arg1$$18.head)) {
|
|
649
|
-
return true;
|
|
650
|
-
} else {
|
|
651
|
-
$f$$51$$180 = f$$51;
|
|
652
|
-
$_arg1$$18$$181 = _arg1$$18.tail;
|
|
653
|
-
continue exists;
|
|
654
|
-
}
|
|
655
|
-
} else {
|
|
656
|
-
return false;
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
export function exists2($f$$52$$182, $bs$$2$$183, $cs$$2$$184) {
|
|
663
|
-
exists2: while (true) {
|
|
664
|
-
const f$$52 = $f$$52$$182,
|
|
665
|
-
bs$$2 = $bs$$2$$183,
|
|
666
|
-
cs$$2 = $cs$$2$$184;
|
|
667
|
-
var $target$$185, x$$44, xs$$82, y$$12, ys$$18;
|
|
668
|
-
|
|
669
|
-
if (bs$$2.tail != null) {
|
|
670
|
-
if (cs$$2.tail != null) {
|
|
671
|
-
$target$$185 = 1;
|
|
672
|
-
x$$44 = bs$$2.head;
|
|
673
|
-
xs$$82 = bs$$2.tail;
|
|
674
|
-
y$$12 = cs$$2.head;
|
|
675
|
-
ys$$18 = cs$$2.tail;
|
|
676
|
-
} else {
|
|
677
|
-
$target$$185 = 2;
|
|
678
|
-
}
|
|
679
|
-
} else if (cs$$2.tail == null) {
|
|
680
|
-
$target$$185 = 0;
|
|
681
|
-
} else {
|
|
682
|
-
$target$$185 = 2;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
switch ($target$$185) {
|
|
686
|
-
case 0:
|
|
687
|
-
{
|
|
688
|
-
return false;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
case 1:
|
|
692
|
-
{
|
|
693
|
-
if (f$$52(x$$44, y$$12)) {
|
|
694
|
-
return true;
|
|
695
|
-
} else {
|
|
696
|
-
$f$$52$$182 = f$$52;
|
|
697
|
-
$bs$$2$$183 = xs$$82;
|
|
698
|
-
$cs$$2$$184 = ys$$18;
|
|
699
|
-
continue exists2;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
case 2:
|
|
704
|
-
{
|
|
705
|
-
throw new Error("Lists had different lengths");
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
break;
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
export function unzip(xs$$83) {
|
|
713
|
-
return foldBack(function (tupledArg$$2, tupledArg$$3) {
|
|
714
|
-
return [new List(tupledArg$$2[0], tupledArg$$3[0]), new List(tupledArg$$2[1], tupledArg$$3[1])];
|
|
715
|
-
}, xs$$83, [new List(), new List()]);
|
|
716
|
-
}
|
|
717
|
-
export function unzip3(xs$$84) {
|
|
718
|
-
return foldBack(function (tupledArg$$4, tupledArg$$5) {
|
|
719
|
-
return [new List(tupledArg$$4[0], tupledArg$$5[0]), new List(tupledArg$$4[1], tupledArg$$5[1]), new List(tupledArg$$4[2], tupledArg$$5[2])];
|
|
720
|
-
}, xs$$84, [new List(), new List(), new List()]);
|
|
721
|
-
}
|
|
722
|
-
export function zip(xs$$85, ys$$19) {
|
|
723
|
-
return map2(function (x$$47, y$$15) {
|
|
724
|
-
return [x$$47, y$$15];
|
|
725
|
-
}, xs$$85, ys$$19);
|
|
726
|
-
}
|
|
727
|
-
export function zip3(xs$$86, ys$$20, zs$$5) {
|
|
728
|
-
return map3(function (x$$48, y$$16, z$$5) {
|
|
729
|
-
return [x$$48, y$$16, z$$5];
|
|
730
|
-
}, xs$$86, ys$$20, zs$$5);
|
|
731
|
-
}
|
|
732
|
-
export function sort(xs$$87, comparer$$1) {
|
|
733
|
-
let xs$$89;
|
|
734
|
-
const xs$$88 = ofList(xs$$87, Array);
|
|
735
|
-
xs$$88.sort(function comparer$$2(x$$49, y$$17) {
|
|
736
|
-
return comparer$$1.Compare(x$$49, y$$17);
|
|
737
|
-
});
|
|
738
|
-
xs$$89 = xs$$88;
|
|
739
|
-
return ofArray(xs$$89);
|
|
740
|
-
}
|
|
741
|
-
export function sortBy(projection, xs$$90, comparer$$3) {
|
|
742
|
-
let xs$$92;
|
|
743
|
-
const xs$$91 = ofList(xs$$90, Array);
|
|
744
|
-
xs$$91.sort(function comparer$$4(x$$50, y$$18) {
|
|
745
|
-
return comparer$$3.Compare(projection(x$$50), projection(y$$18));
|
|
746
|
-
});
|
|
747
|
-
xs$$92 = xs$$91;
|
|
748
|
-
return ofArray(xs$$92);
|
|
749
|
-
}
|
|
750
|
-
export function sortDescending(xs$$93, comparer$$5) {
|
|
751
|
-
let xs$$95;
|
|
752
|
-
const xs$$94 = ofList(xs$$93, Array);
|
|
753
|
-
xs$$94.sort(function comparer$$6(x$$51, y$$19) {
|
|
754
|
-
return comparer$$5.Compare(x$$51, y$$19) * -1;
|
|
755
|
-
});
|
|
756
|
-
xs$$95 = xs$$94;
|
|
757
|
-
return ofArray(xs$$95);
|
|
758
|
-
}
|
|
759
|
-
export function sortByDescending(projection$$1, xs$$96, comparer$$7) {
|
|
760
|
-
let xs$$98;
|
|
761
|
-
const xs$$97 = ofList(xs$$96, Array);
|
|
762
|
-
xs$$97.sort(function comparer$$8(x$$52, y$$20) {
|
|
763
|
-
return comparer$$7.Compare(projection$$1(x$$52), projection$$1(y$$20)) * -1;
|
|
764
|
-
});
|
|
765
|
-
xs$$98 = xs$$97;
|
|
766
|
-
return ofArray(xs$$98);
|
|
767
|
-
}
|
|
768
|
-
export function sortWith(comparer$$9, xs$$99) {
|
|
769
|
-
let xs$$101;
|
|
770
|
-
const xs$$100 = ofList(xs$$99, Array);
|
|
771
|
-
xs$$100.sort(comparer$$9);
|
|
772
|
-
xs$$101 = xs$$100;
|
|
773
|
-
return ofArray(xs$$101);
|
|
774
|
-
}
|
|
775
|
-
export function sum(xs$$102, adder) {
|
|
776
|
-
return fold(function (acc$$21, x$$53) {
|
|
777
|
-
return adder.Add(acc$$21, x$$53);
|
|
778
|
-
}, adder.GetZero(), xs$$102);
|
|
779
|
-
}
|
|
780
|
-
export function sumBy(f$$53, xs$$103, adder$$1) {
|
|
781
|
-
return fold(function (acc$$22, x$$54) {
|
|
782
|
-
return adder$$1.Add(acc$$22, f$$53(x$$54));
|
|
783
|
-
}, adder$$1.GetZero(), xs$$103);
|
|
784
|
-
}
|
|
785
|
-
export function maxBy(projection$$2, xs$$104, comparer$$11) {
|
|
786
|
-
return reduce(function (x$$55, y$$21) {
|
|
787
|
-
return comparer$$11.Compare(projection$$2(y$$21), projection$$2(x$$55)) > 0 ? y$$21 : x$$55;
|
|
788
|
-
}, xs$$104);
|
|
789
|
-
}
|
|
790
|
-
export function max(li, comparer$$12) {
|
|
791
|
-
return reduce(function (x$$56, y$$22) {
|
|
792
|
-
return comparer$$12.Compare(y$$22, x$$56) > 0 ? y$$22 : x$$56;
|
|
793
|
-
}, li);
|
|
794
|
-
}
|
|
795
|
-
export function minBy(projection$$3, xs$$105, comparer$$13) {
|
|
796
|
-
return reduce(function (x$$57, y$$23) {
|
|
797
|
-
return comparer$$13.Compare(projection$$3(y$$23), projection$$3(x$$57)) > 0 ? x$$57 : y$$23;
|
|
798
|
-
}, xs$$105);
|
|
799
|
-
}
|
|
800
|
-
export function min(xs$$106, comparer$$14) {
|
|
801
|
-
return reduce(function (x$$58, y$$24) {
|
|
802
|
-
return comparer$$14.Compare(y$$24, x$$58) > 0 ? x$$58 : y$$24;
|
|
803
|
-
}, xs$$106);
|
|
804
|
-
}
|
|
805
|
-
export function average(xs$$107, averager) {
|
|
806
|
-
const total = fold(function (acc$$23, x$$59) {
|
|
807
|
-
return averager.Add(acc$$23, x$$59);
|
|
808
|
-
}, averager.GetZero(), xs$$107);
|
|
809
|
-
return averager.DivideByInt(total, length(xs$$107));
|
|
810
|
-
}
|
|
811
|
-
export function averageBy(f$$54, xs$$108, averager$$1) {
|
|
812
|
-
const total$$1 = fold(function (acc$$24, x$$60) {
|
|
813
|
-
return averager$$1.Add(acc$$24, f$$54(x$$60));
|
|
814
|
-
}, averager$$1.GetZero(), xs$$108);
|
|
815
|
-
return averager$$1.DivideByInt(total$$1, length(xs$$108));
|
|
816
|
-
}
|
|
817
|
-
export function permute(f$$55, xs$$109) {
|
|
818
|
-
let xs$$110;
|
|
819
|
-
let array$$3;
|
|
820
|
-
array$$3 = ofList(xs$$109, Array);
|
|
821
|
-
xs$$110 = permute$$1(f$$55, array$$3);
|
|
822
|
-
return ofArray(xs$$110);
|
|
823
|
-
}
|
|
824
|
-
export function chunkBySize(chunkSize, xs$$111) {
|
|
825
|
-
let xs$$114;
|
|
826
|
-
let xs$$112;
|
|
827
|
-
let array$$4;
|
|
828
|
-
array$$4 = ofList(xs$$111, Array);
|
|
829
|
-
xs$$112 = chunkBySize$$1(chunkSize, array$$4);
|
|
830
|
-
xs$$114 = ofArray(xs$$112);
|
|
831
|
-
return map(function f$$56(xs$$113) {
|
|
832
|
-
return ofArray(xs$$113);
|
|
833
|
-
}, xs$$114);
|
|
834
|
-
}
|
|
835
|
-
export function skip(i$$16, xs$$115) {
|
|
836
|
-
const skipInner = function skipInner($i$$17$$240, $xs$$116$$241) {
|
|
837
|
-
skipInner: while (true) {
|
|
838
|
-
const i$$17 = $i$$17$$240,
|
|
839
|
-
xs$$116 = $xs$$116$$241;
|
|
840
|
-
|
|
841
|
-
if (i$$17 === 0) {
|
|
842
|
-
return xs$$116;
|
|
843
|
-
} else if (xs$$116.tail != null) {
|
|
844
|
-
$i$$17$$240 = i$$17 - 1;
|
|
845
|
-
$xs$$116$$241 = xs$$116.tail;
|
|
846
|
-
continue skipInner;
|
|
847
|
-
} else {
|
|
848
|
-
throw new Error("The input sequence has an insufficient number of elements.");
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
break;
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
if (i$$16 < 0) {
|
|
856
|
-
throw new Error("The input must be non-negative.");
|
|
857
|
-
} else {
|
|
858
|
-
var $target$$242, i$$20, xs$$119;
|
|
859
|
-
|
|
860
|
-
if (i$$16 === 0) {
|
|
861
|
-
$target$$242 = 0;
|
|
862
|
-
} else if (i$$16 === 1) {
|
|
863
|
-
if (xs$$115.tail != null) {
|
|
864
|
-
$target$$242 = 1;
|
|
865
|
-
} else {
|
|
866
|
-
$target$$242 = 2;
|
|
867
|
-
i$$20 = i$$16;
|
|
868
|
-
xs$$119 = xs$$115;
|
|
869
|
-
}
|
|
870
|
-
} else {
|
|
871
|
-
$target$$242 = 2;
|
|
872
|
-
i$$20 = i$$16;
|
|
873
|
-
xs$$119 = xs$$115;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
switch ($target$$242) {
|
|
877
|
-
case 0:
|
|
878
|
-
{
|
|
879
|
-
return xs$$115;
|
|
880
|
-
}
|
|
881
|
-
|
|
882
|
-
case 1:
|
|
883
|
-
{
|
|
884
|
-
return xs$$115.tail;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
case 2:
|
|
888
|
-
{
|
|
889
|
-
return skipInner(i$$20, xs$$119);
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
export function skipWhile($predicate$$243, $xs$$120$$244) {
|
|
895
|
-
skipWhile: while (true) {
|
|
896
|
-
const predicate = $predicate$$243,
|
|
897
|
-
xs$$120 = $xs$$120$$244;
|
|
898
|
-
var $target$$245, h$$4, t$$4;
|
|
899
|
-
|
|
900
|
-
if (xs$$120.tail != null) {
|
|
901
|
-
if (predicate(xs$$120.head)) {
|
|
902
|
-
$target$$245 = 0;
|
|
903
|
-
h$$4 = xs$$120.head;
|
|
904
|
-
t$$4 = xs$$120.tail;
|
|
905
|
-
} else {
|
|
906
|
-
$target$$245 = 1;
|
|
907
|
-
}
|
|
908
|
-
} else {
|
|
909
|
-
$target$$245 = 1;
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
switch ($target$$245) {
|
|
913
|
-
case 0:
|
|
914
|
-
{
|
|
915
|
-
$predicate$$243 = predicate;
|
|
916
|
-
$xs$$120$$244 = t$$4;
|
|
917
|
-
continue skipWhile;
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
case 1:
|
|
921
|
-
{
|
|
922
|
-
return xs$$120;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
break;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
export function takeSplitAux($error$$246, $i$$21$$247, $acc$$25$$248, $xs$$121$$249) {
|
|
930
|
-
takeSplitAux: while (true) {
|
|
931
|
-
const error = $error$$246,
|
|
932
|
-
i$$21 = $i$$21$$247,
|
|
933
|
-
acc$$25 = $acc$$25$$248,
|
|
934
|
-
xs$$121 = $xs$$121$$249;
|
|
935
|
-
|
|
936
|
-
if (i$$21 === 0) {
|
|
937
|
-
return [reverse(acc$$25), xs$$121];
|
|
938
|
-
} else if (xs$$121.tail != null) {
|
|
939
|
-
$error$$246 = error;
|
|
940
|
-
$i$$21$$247 = i$$21 - 1;
|
|
941
|
-
$acc$$25$$248 = new List(xs$$121.head, acc$$25);
|
|
942
|
-
$xs$$121$$249 = xs$$121.tail;
|
|
943
|
-
continue takeSplitAux;
|
|
944
|
-
} else {
|
|
945
|
-
if (error) {
|
|
946
|
-
throw new Error("The input sequence has an insufficient number of elements.");
|
|
947
|
-
} else {
|
|
948
|
-
return [reverse(acc$$25), xs$$121];
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
break;
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
export function take(i$$22, xs$$123) {
|
|
956
|
-
if (i$$22 < 0) {
|
|
957
|
-
throw new Error("The input must be non-negative.");
|
|
958
|
-
} else {
|
|
959
|
-
var $target$$252, i$$25, xs$$124;
|
|
960
|
-
|
|
961
|
-
if (i$$22 === 0) {
|
|
962
|
-
$target$$252 = 0;
|
|
963
|
-
} else if (i$$22 === 1) {
|
|
964
|
-
if (xs$$123.tail != null) {
|
|
965
|
-
$target$$252 = 1;
|
|
966
|
-
} else {
|
|
967
|
-
$target$$252 = 2;
|
|
968
|
-
i$$25 = i$$22;
|
|
969
|
-
xs$$124 = xs$$123;
|
|
970
|
-
}
|
|
971
|
-
} else {
|
|
972
|
-
$target$$252 = 2;
|
|
973
|
-
i$$25 = i$$22;
|
|
974
|
-
xs$$124 = xs$$123;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
switch ($target$$252) {
|
|
978
|
-
case 0:
|
|
979
|
-
{
|
|
980
|
-
return new List();
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
case 1:
|
|
984
|
-
{
|
|
985
|
-
return new List(xs$$123.head, new List());
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
case 2:
|
|
989
|
-
{
|
|
990
|
-
const tuple = takeSplitAux(true, i$$25, new List(), xs$$124);
|
|
991
|
-
return tuple[0];
|
|
992
|
-
}
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
export function takeWhile(predicate$$1, xs$$125) {
|
|
997
|
-
if (xs$$125.tail != null) {
|
|
998
|
-
if (xs$$125.tail.tail == null) {
|
|
999
|
-
if (predicate$$1(xs$$125.head)) {
|
|
1000
|
-
return xs$$125;
|
|
1001
|
-
} else {
|
|
1002
|
-
return xs$$125.tail;
|
|
1003
|
-
}
|
|
1004
|
-
} else {
|
|
1005
|
-
if (!predicate$$1(xs$$125.head)) {
|
|
1006
|
-
return new List();
|
|
1007
|
-
} else {
|
|
1008
|
-
return new List(xs$$125.head, takeWhile(predicate$$1, xs$$125.tail));
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
} else {
|
|
1012
|
-
return xs$$125;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
export function truncate(i$$26, xs$$127) {
|
|
1016
|
-
if (i$$26 < 0) {
|
|
1017
|
-
throw new Error("The input must be non-negative.");
|
|
1018
|
-
} else {
|
|
1019
|
-
var $target$$257, i$$29, xs$$128;
|
|
1020
|
-
|
|
1021
|
-
if (i$$26 === 0) {
|
|
1022
|
-
$target$$257 = 0;
|
|
1023
|
-
} else if (i$$26 === 1) {
|
|
1024
|
-
if (xs$$127.tail != null) {
|
|
1025
|
-
$target$$257 = 1;
|
|
1026
|
-
} else {
|
|
1027
|
-
$target$$257 = 2;
|
|
1028
|
-
i$$29 = i$$26;
|
|
1029
|
-
xs$$128 = xs$$127;
|
|
1030
|
-
}
|
|
1031
|
-
} else {
|
|
1032
|
-
$target$$257 = 2;
|
|
1033
|
-
i$$29 = i$$26;
|
|
1034
|
-
xs$$128 = xs$$127;
|
|
1035
|
-
}
|
|
1036
|
-
|
|
1037
|
-
switch ($target$$257) {
|
|
1038
|
-
case 0:
|
|
1039
|
-
{
|
|
1040
|
-
return new List();
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
case 1:
|
|
1044
|
-
{
|
|
1045
|
-
return new List(xs$$127.head, new List());
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
case 2:
|
|
1049
|
-
{
|
|
1050
|
-
const tuple$$1 = takeSplitAux(false, i$$29, new List(), xs$$128);
|
|
1051
|
-
return tuple$$1[0];
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
export function splitAt(i$$30, xs$$129) {
|
|
1057
|
-
if (i$$30 < 0) {
|
|
1058
|
-
throw new Error("The input must be non-negative.");
|
|
1059
|
-
} else {
|
|
1060
|
-
var $target$$260, i$$33, xs$$131;
|
|
1061
|
-
|
|
1062
|
-
if (i$$30 === 0) {
|
|
1063
|
-
$target$$260 = 0;
|
|
1064
|
-
} else if (i$$30 === 1) {
|
|
1065
|
-
if (xs$$129.tail != null) {
|
|
1066
|
-
$target$$260 = 1;
|
|
1067
|
-
} else {
|
|
1068
|
-
$target$$260 = 2;
|
|
1069
|
-
i$$33 = i$$30;
|
|
1070
|
-
xs$$131 = xs$$129;
|
|
1071
|
-
}
|
|
1072
|
-
} else {
|
|
1073
|
-
$target$$260 = 2;
|
|
1074
|
-
i$$33 = i$$30;
|
|
1075
|
-
xs$$131 = xs$$129;
|
|
1076
|
-
}
|
|
1077
|
-
|
|
1078
|
-
switch ($target$$260) {
|
|
1079
|
-
case 0:
|
|
1080
|
-
{
|
|
1081
|
-
return [new List(), xs$$129];
|
|
1082
|
-
}
|
|
1083
|
-
|
|
1084
|
-
case 1:
|
|
1085
|
-
{
|
|
1086
|
-
return [new List(xs$$129.head, new List()), xs$$129.tail];
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
case 2:
|
|
1090
|
-
{
|
|
1091
|
-
return takeSplitAux(true, i$$33, new List(), xs$$131);
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
export function outOfRange() {
|
|
1097
|
-
throw new Error("Index out of range");
|
|
1098
|
-
}
|
|
1099
|
-
export function slice(lower, upper, xs$$132) {
|
|
1100
|
-
const lower$$1 = defaultArg(lower, 0) | 0;
|
|
1101
|
-
const hasUpper = upper != null;
|
|
1102
|
-
|
|
1103
|
-
if (lower$$1 < 0) {
|
|
1104
|
-
return outOfRange();
|
|
1105
|
-
} else if (hasUpper ? upper < lower$$1 : false) {
|
|
1106
|
-
return new List();
|
|
1107
|
-
} else {
|
|
1108
|
-
let lastIndex = -1 | 0;
|
|
1109
|
-
let res$$2;
|
|
1110
|
-
const state$$13 = new List();
|
|
1111
|
-
res$$2 = foldIndexed(function f$$57(i$$34, acc$$26, x$$67) {
|
|
1112
|
-
lastIndex = i$$34;
|
|
1113
|
-
|
|
1114
|
-
if (lower$$1 <= i$$34 ? !hasUpper ? true : i$$34 <= upper : false) {
|
|
1115
|
-
return new List(x$$67, acc$$26);
|
|
1116
|
-
} else {
|
|
1117
|
-
return acc$$26;
|
|
1118
|
-
}
|
|
1119
|
-
}, state$$13, xs$$132);
|
|
1120
|
-
|
|
1121
|
-
if (lower$$1 > lastIndex + 1 ? true : hasUpper ? upper > lastIndex : false) {
|
|
1122
|
-
outOfRange();
|
|
1123
|
-
} else {
|
|
1124
|
-
void null;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
return reverse(res$$2);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
export function distinctBy(projection$$4, xs$$134, eq$$2) {
|
|
1131
|
-
const hashSet = createMutable([], eq$$2);
|
|
1132
|
-
return filter(function f$$58($arg$$1) {
|
|
1133
|
-
const arg00$$1 = projection$$4($arg$$1);
|
|
1134
|
-
return addToSet(arg00$$1, hashSet);
|
|
1135
|
-
}, xs$$134);
|
|
1136
|
-
}
|
|
1137
|
-
export function distinct(xs$$136, eq$$3) {
|
|
1138
|
-
return distinctBy(function (x$$68) {
|
|
1139
|
-
return x$$68;
|
|
1140
|
-
}, xs$$136, eq$$3);
|
|
1141
|
-
}
|
|
1142
|
-
export function exactlyOne(xs$$137) {
|
|
1143
|
-
if (xs$$137.tail != null) {
|
|
1144
|
-
if (xs$$137.tail.tail != null) {
|
|
1145
|
-
throw new Error("Input list too long\\nParameter name: list");
|
|
1146
|
-
} else {
|
|
1147
|
-
return xs$$137.head;
|
|
1148
|
-
}
|
|
1149
|
-
} else {
|
|
1150
|
-
throw new Error("The input sequence was empty\\nParameter name: list");
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
export function groupBy(projection$$5, xs$$139, eq$$4) {
|
|
1154
|
-
const dict = createMutable$$1([], eq$$4);
|
|
1155
|
-
let keys = new List();
|
|
1156
|
-
iterate(function f$$59(v$$2) {
|
|
1157
|
-
const key = projection$$5(v$$2);
|
|
1158
|
-
const matchValue$$16 = tryGetValue(dict, key, null);
|
|
1159
|
-
|
|
1160
|
-
if (matchValue$$16[0]) {
|
|
1161
|
-
dict.set(key, new List(v$$2, matchValue$$16[1]));
|
|
1162
|
-
} else {
|
|
1163
|
-
addToDict(dict, key, new List(v$$2, new List()));
|
|
1164
|
-
keys = new List(key, keys);
|
|
1165
|
-
}
|
|
1166
|
-
}, xs$$139);
|
|
1167
|
-
let result$$1 = new List();
|
|
1168
|
-
const xs$$141 = keys;
|
|
1169
|
-
iterate(function f$$60(key$$1) {
|
|
1170
|
-
result$$1 = new List([key$$1, reverse(getItemFromDict(dict, key$$1))], result$$1);
|
|
1171
|
-
}, xs$$141);
|
|
1172
|
-
return result$$1;
|
|
1173
|
-
}
|
|
1174
|
-
export function countBy(projection$$6, xs$$142, eq$$5) {
|
|
1175
|
-
const dict$$1 = createMutable$$1([], eq$$5);
|
|
1176
|
-
let keys$$1 = new List();
|
|
1177
|
-
iterate(function f$$61(v$$3) {
|
|
1178
|
-
const key$$2 = projection$$6(v$$3);
|
|
1179
|
-
const matchValue$$17 = tryGetValue(dict$$1, key$$2, 0);
|
|
1180
|
-
|
|
1181
|
-
if (matchValue$$17[0]) {
|
|
1182
|
-
dict$$1.set(key$$2, matchValue$$17[1] + 1);
|
|
1183
|
-
} else {
|
|
1184
|
-
dict$$1.set(key$$2, 1);
|
|
1185
|
-
keys$$1 = new List(key$$2, keys$$1);
|
|
1186
|
-
}
|
|
1187
|
-
}, xs$$142);
|
|
1188
|
-
let result$$2 = new List();
|
|
1189
|
-
const xs$$144 = keys$$1;
|
|
1190
|
-
iterate(function f$$62(key$$3) {
|
|
1191
|
-
result$$2 = new List([key$$3, getItemFromDict(dict$$1, key$$3)], result$$2);
|
|
1192
|
-
}, xs$$144);
|
|
1193
|
-
return result$$2;
|
|
1194
|
-
}
|
|
1195
|
-
export function where(predicate$$2, source) {
|
|
1196
|
-
return filter(predicate$$2, source);
|
|
1197
|
-
}
|
|
1198
|
-
export function pairwise(source$$1) {
|
|
1199
|
-
const xs$$145 = pairwise$$1(source$$1);
|
|
1200
|
-
return ofSeq(xs$$145);
|
|
1201
|
-
}
|
|
1202
|
-
export function windowed(windowSize, source$$2) {
|
|
1203
|
-
if (windowSize <= 0) {
|
|
1204
|
-
throw new Error("windowSize must be positive");
|
|
1205
|
-
} else {
|
|
1206
|
-
void null;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
let res$$3 = new List();
|
|
1210
|
-
|
|
1211
|
-
for (let i$$35 = length(source$$2); i$$35 >= windowSize; i$$35--) {
|
|
1212
|
-
res$$3 = new List(slice(i$$35 - windowSize, i$$35 - 1, source$$2), res$$3);
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
return res$$3;
|
|
1216
|
-
}
|
|
1217
|
-
export function splitInto(chunks, source$$3) {
|
|
1218
|
-
let xs$$148;
|
|
1219
|
-
let xs$$146;
|
|
1220
|
-
let array$$5;
|
|
1221
|
-
array$$5 = ofList(source$$3, Array);
|
|
1222
|
-
xs$$146 = splitInto$$1(chunks, array$$5);
|
|
1223
|
-
xs$$148 = ofArray(xs$$146);
|
|
1224
|
-
return map(function f$$63(xs$$147) {
|
|
1225
|
-
return ofArray(xs$$147);
|
|
1226
|
-
}, xs$$148);
|
|
1227
|
-
}
|
|
1228
|
-
export function transpose(lists$$1) {
|
|
1229
|
-
let xs$$150;
|
|
1230
|
-
let source$$5;
|
|
1231
|
-
source$$5 = transpose$$1(lists$$1);
|
|
1232
|
-
xs$$150 = map$$1(ofSeq, source$$5);
|
|
1233
|
-
return ofSeq(xs$$150);
|
|
1234
|
-
}
|