@fable-org/fable-library-js 2.0.0-rc.6 → 2.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/CHANGELOG.md +35 -1
- package/Date.js +80 -8
- package/Decimal.js +6 -4
- package/Reflection.js +20 -1
- package/Seq.js +10 -2
- package/Set.js +91 -63
- package/String.js +29 -4
- package/System.Text.js +33 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
last_commit_released: 63bcd3d90f37cb3934edcc59b5f54f49ffab3896
|
|
3
|
+
updaters:
|
|
4
|
+
- package.json:
|
|
5
|
+
file: package.json
|
|
6
|
+
- regex:
|
|
7
|
+
file: ./../Fable.Transforms/Global/Compiler.fs
|
|
8
|
+
pattern: (?<=let JS_LIBRARY_VERSION = ").*(?=")
|
|
9
|
+
---
|
|
10
|
+
|
|
1
11
|
# Changelog
|
|
2
12
|
|
|
3
13
|
All notable changes to this project will be documented in this file.
|
|
@@ -5,7 +15,31 @@ All notable changes to this project will be documented in this file.
|
|
|
5
15
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
16
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
17
|
|
|
8
|
-
##
|
|
18
|
+
## 2.1.0 - 2026-05-28
|
|
19
|
+
|
|
20
|
+
### 🚀 Features
|
|
21
|
+
|
|
22
|
+
* *(js/ts/python)* Add missing standard DateTime format specifiers for JS/TS and Python (#4547) ([90f5eb7](https://github.com/fable-compiler/Fable/commit/90f5eb7f61710bc679f6fdec30ff5d864984ac08))
|
|
23
|
+
* *(js/ts/python)* Add missing StringBuilder.Append overloads for numeric types (#4568) ([b402c30](https://github.com/fable-compiler/Fable/commit/b402c30d04bfca8644314ba4b21894abfff6a713))
|
|
24
|
+
|
|
25
|
+
### 🐞 Bug Fixes
|
|
26
|
+
|
|
27
|
+
* [JS/TS] Fix DatetimeOffset.ToString("s") (#4596) ([3ce6f3f](https://github.com/fable-compiler/Fable/commit/3ce6f3fd88cc7f67e34e2bbc311e722c55ffbf45))
|
|
28
|
+
* *(js/ts)* Fix datetime custom format off by one year (#4558) ([83bdbb5](https://github.com/fable-compiler/Fable/commit/83bdbb5b34e70eae203831a3a442d477d15911e1))
|
|
29
|
+
* *(js/ts)* Hex format specifier uses no padding unless precision is specified (#4603) ([ba9857a](https://github.com/fable-compiler/Fable/commit/ba9857a4dcbf7ab1f936241f6619fda43e039040))
|
|
30
|
+
* *(js/ts)* Fix Decimal.GetBits returning incorrect mantissa after round arithmetic result (#4561) ([345bcd4](https://github.com/fable-compiler/Fable/commit/345bcd4b99417b304c71059966126fad74cf3a97))
|
|
31
|
+
* *(js/ts)* Fix G/g format specifier corrupting exponential notation when trimming trailing zeros (#4587) ([773c098](https://github.com/fable-compiler/Fable/commit/773c098a8f7ac7e8db1d4e490dec1294a80321ee))
|
|
32
|
+
* *(js/ts/python)* Fix FSharpOption not recognized as union type in F# reflection (#4529) ([d78a37d](https://github.com/fable-compiler/Fable/commit/d78a37db9f4c25eb51fac8afcd320b4ea36c60a7))
|
|
33
|
+
* *(ts)* Enforce browser-only compatibility in fable-library-ts tsconfig (#4563) ([10c81c1](https://github.com/fable-compiler/Fable/commit/10c81c1361208eb61f5fa78c6704e6fccc068fb1))
|
|
34
|
+
|
|
35
|
+
<strong><small>[View changes on Github](https://github.com/fable-compiler/Fable/compare/b471dc16fc3b5132af77b5974d1669c9b8220cca..63bcd3d90f37cb3934edcc59b5f54f49ffab3896)</small></strong>
|
|
36
|
+
|
|
37
|
+
## 2.0.0 - 2026-04-21
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
* [JS/TS] Fix `ResizeArray` (`System.Collections.Generic.List`) equality to use reference equality instead of structural equality (fixes #3718)
|
|
42
|
+
* [JS/TS] Fix `String.Contains` ignoring `StringComparison` argument (second argument was silently discarded)
|
|
9
43
|
|
|
10
44
|
## 2.0.0-rc.6 - 2026-04-07
|
|
11
45
|
|
package/Date.js
CHANGED
|
@@ -254,13 +254,13 @@ function dateToStringWithCustomFormat(date, format, utc) {
|
|
|
254
254
|
cursorPos += tokenLength;
|
|
255
255
|
switch (tokenLength) {
|
|
256
256
|
case 1:
|
|
257
|
-
result += localizedDate
|
|
257
|
+
result += year(localizedDate) % 100;
|
|
258
258
|
break;
|
|
259
259
|
case 2:
|
|
260
|
-
result += padWithZeros(localizedDate
|
|
260
|
+
result += padWithZeros(year(localizedDate) % 100, 2);
|
|
261
261
|
break;
|
|
262
262
|
default:
|
|
263
|
-
result += padWithZeros(localizedDate
|
|
263
|
+
result += padWithZeros(year(localizedDate), tokenLength);
|
|
264
264
|
break;
|
|
265
265
|
}
|
|
266
266
|
break;
|
|
@@ -384,10 +384,32 @@ function dateToStringWithOffset(date, format) {
|
|
|
384
384
|
switch (format) {
|
|
385
385
|
case "D": return dateToString_D(d);
|
|
386
386
|
case "d": return dateToString_d(d);
|
|
387
|
-
case "
|
|
388
|
-
case "
|
|
387
|
+
case "F": return dateToString_D(d) + " " + dateToString_T(d);
|
|
388
|
+
case "f": return dateToString_D(d) + " " + dateToString_t(d);
|
|
389
|
+
case "G": return dateToString_d(d) + " " + dateToString_T(d);
|
|
390
|
+
case "g": return dateToString_d(d) + " " + dateToString_t(d);
|
|
391
|
+
case "M":
|
|
392
|
+
case "m": return dateToString_M(d);
|
|
389
393
|
case "O":
|
|
390
394
|
case "o": return dateToISOStringWithOffset(d, (date.offset ?? 0));
|
|
395
|
+
case "R":
|
|
396
|
+
case "r": {
|
|
397
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
398
|
+
return dateToString_R(utcDate);
|
|
399
|
+
}
|
|
400
|
+
case "s": return dateToString_s(toUniversalTime(d));
|
|
401
|
+
case "T": return dateToString_T(toUniversalTime(d));
|
|
402
|
+
case "t": return dateToString_t(toUniversalTime(d));
|
|
403
|
+
case "u": {
|
|
404
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
405
|
+
return dateToString_u(utcDate);
|
|
406
|
+
}
|
|
407
|
+
case "U": {
|
|
408
|
+
const utcDate = DateTime(date.getTime(), DateTimeKind.Utc);
|
|
409
|
+
return dateToString_D(utcDate) + " " + dateToString_T(utcDate);
|
|
410
|
+
}
|
|
411
|
+
case "Y":
|
|
412
|
+
case "y": return dateToString_Y(d);
|
|
391
413
|
default: throw new Exception("Unrecognized Date print format");
|
|
392
414
|
}
|
|
393
415
|
}
|
|
@@ -415,6 +437,44 @@ function dateToString_t(date) {
|
|
|
415
437
|
return padWithZeros(hour(date), 2)
|
|
416
438
|
+ ":" + padWithZeros(minute(date), 2);
|
|
417
439
|
}
|
|
440
|
+
// RFC 1123: "Thu, 01 Jan 2009 00:00:00 GMT" — always UTC
|
|
441
|
+
function dateToString_R(date) {
|
|
442
|
+
const utcDate = toUniversalTime(date);
|
|
443
|
+
return shortDays[dayOfWeek(utcDate)] + ", "
|
|
444
|
+
+ padWithZeros(day(utcDate), 2) + " "
|
|
445
|
+
+ shortMonths[month(utcDate) - 1] + " "
|
|
446
|
+
+ year(utcDate) + " "
|
|
447
|
+
+ padWithZeros(hour(utcDate), 2) + ":"
|
|
448
|
+
+ padWithZeros(minute(utcDate), 2) + ":"
|
|
449
|
+
+ padWithZeros(second(utcDate), 2) + " GMT";
|
|
450
|
+
}
|
|
451
|
+
// Sortable ISO 8601, no timezone: "2009-06-15T13:45:30"
|
|
452
|
+
function dateToString_s(date) {
|
|
453
|
+
return padWithZeros(year(date), 4) + "-"
|
|
454
|
+
+ padWithZeros(month(date), 2) + "-"
|
|
455
|
+
+ padWithZeros(day(date), 2) + "T"
|
|
456
|
+
+ padWithZeros(hour(date), 2) + ":"
|
|
457
|
+
+ padWithZeros(minute(date), 2) + ":"
|
|
458
|
+
+ padWithZeros(second(date), 2);
|
|
459
|
+
}
|
|
460
|
+
// Universal sortable: "2009-06-15 13:45:30Z" — always UTC
|
|
461
|
+
function dateToString_u(date) {
|
|
462
|
+
const utcDate = toUniversalTime(date);
|
|
463
|
+
return padWithZeros(year(utcDate), 4) + "-"
|
|
464
|
+
+ padWithZeros(month(utcDate), 2) + "-"
|
|
465
|
+
+ padWithZeros(day(utcDate), 2) + " "
|
|
466
|
+
+ padWithZeros(hour(utcDate), 2) + ":"
|
|
467
|
+
+ padWithZeros(minute(utcDate), 2) + ":"
|
|
468
|
+
+ padWithZeros(second(utcDate), 2) + "Z";
|
|
469
|
+
}
|
|
470
|
+
// Month/day (InvariantCulture "MMMM dd"): "June 15"
|
|
471
|
+
function dateToString_M(date) {
|
|
472
|
+
return longMonths[month(date) - 1] + " " + padWithZeros(day(date), 2);
|
|
473
|
+
}
|
|
474
|
+
// Year/month (InvariantCulture "yyyy MMMM"): "2009 June"
|
|
475
|
+
function dateToString_Y(date) {
|
|
476
|
+
return year(date) + " " + longMonths[month(date) - 1];
|
|
477
|
+
}
|
|
418
478
|
function dateToStringWithKind(date, format) {
|
|
419
479
|
const utc = date.kind === DateTimeKind.Utc;
|
|
420
480
|
if (typeof format !== "string") {
|
|
@@ -424,11 +484,23 @@ function dateToStringWithKind(date, format) {
|
|
|
424
484
|
switch (format) {
|
|
425
485
|
case "D": return dateToString_D(date);
|
|
426
486
|
case "d": return dateToString_d(date);
|
|
487
|
+
case "F": return dateToString_D(date) + " " + dateToString_T(date);
|
|
488
|
+
case "f": return dateToString_D(date) + " " + dateToString_t(date);
|
|
489
|
+
case "G": return dateToString_d(date) + " " + dateToString_T(date);
|
|
490
|
+
case "g": return dateToString_d(date) + " " + dateToString_t(date);
|
|
491
|
+
case "M":
|
|
492
|
+
case "m": return dateToString_M(date);
|
|
493
|
+
case "O":
|
|
494
|
+
case "o": return dateToISOString(date, utc);
|
|
495
|
+
case "R":
|
|
496
|
+
case "r": return dateToString_R(date);
|
|
497
|
+
case "s": return dateToString_s(date);
|
|
427
498
|
case "T": return dateToString_T(date);
|
|
428
499
|
case "t": return dateToString_t(date);
|
|
429
|
-
case "
|
|
430
|
-
case "
|
|
431
|
-
|
|
500
|
+
case "u": return dateToString_u(date);
|
|
501
|
+
case "U": return dateToString_D(toUniversalTime(date)) + " " + dateToString_T(toUniversalTime(date));
|
|
502
|
+
case "Y":
|
|
503
|
+
case "y": return dateToString_Y(date);
|
|
432
504
|
default:
|
|
433
505
|
throw new Exception("Unrecognized Date print format");
|
|
434
506
|
}
|
package/Decimal.js
CHANGED
|
@@ -207,14 +207,16 @@ export function fromParts(low, mid, high, isNegative, scale) {
|
|
|
207
207
|
}
|
|
208
208
|
export function getBits(d) {
|
|
209
209
|
const bitSize = 96;
|
|
210
|
-
const
|
|
210
|
+
const decStr = d.toString();
|
|
211
|
+
const absStr = decStr[0] === "-" ? decStr.slice(1) : decStr;
|
|
212
|
+
const dotPos = absStr.indexOf(".");
|
|
213
|
+
const scale = dotPos < 0 ? 0 : absStr.length - dotPos - 1;
|
|
214
|
+
const mantissaStr = absStr.replace(".", "");
|
|
215
|
+
const decDigits = Uint8Array.from(mantissaStr, ch => ch.charCodeAt(0) - 48);
|
|
211
216
|
const hexDigits = decimalToHex(decDigits, bitSize);
|
|
212
217
|
const low = getInt32Bits(hexDigits, 0);
|
|
213
218
|
const mid = getInt32Bits(hexDigits, 8);
|
|
214
219
|
const high = getInt32Bits(hexDigits, 16);
|
|
215
|
-
const decStr = d.toString();
|
|
216
|
-
const dotPos = decStr.indexOf(".");
|
|
217
|
-
const scale = dotPos < 0 ? 0 : decStr.length - dotPos - 1;
|
|
218
220
|
const signExp = ((scale & 0x7F) << 16) | (d.s < 0 ? 0x80000000 : 0);
|
|
219
221
|
return [low, mid, high, signExp];
|
|
220
222
|
}
|
package/Reflection.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Record, Union } from "./Types.js";
|
|
2
2
|
import { Exception, combineHashCodes, equalArraysWith, stringHash } from "./Util.js";
|
|
3
3
|
import Decimal from "./Decimal.js";
|
|
4
|
+
import { Some, some } from "./Option.js";
|
|
4
5
|
export class CaseInfo {
|
|
5
6
|
constructor(declaringType, tag, name, fields) {
|
|
6
7
|
this.declaringType = declaringType;
|
|
@@ -85,7 +86,11 @@ export function lambda_type(argType, returnType) {
|
|
|
85
86
|
return new TypeInfo("Microsoft.FSharp.Core.FSharpFunc`2", [argType, returnType]);
|
|
86
87
|
}
|
|
87
88
|
export function option_type(generic) {
|
|
88
|
-
|
|
89
|
+
const t = new TypeInfo("Microsoft.FSharp.Core.FSharpOption`1", [generic], undefined, undefined, undefined, () => [
|
|
90
|
+
new CaseInfo(t, 0, "None"),
|
|
91
|
+
new CaseInfo(t, 1, "Some", [["value", generic]])
|
|
92
|
+
]);
|
|
93
|
+
return t;
|
|
89
94
|
}
|
|
90
95
|
export function list_type(generic) {
|
|
91
96
|
return new TypeInfo("Microsoft.FSharp.Collections.FSharpList`1", [generic]);
|
|
@@ -351,6 +356,16 @@ export function isFunction(t) {
|
|
|
351
356
|
// FSharpValue
|
|
352
357
|
export function getUnionFields(v, t) {
|
|
353
358
|
const cases = getUnionCases(t);
|
|
359
|
+
// Special handling for option types (None is undefined, Some is the value or a Some wrapper)
|
|
360
|
+
if (t.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
|
|
361
|
+
if (v == null) {
|
|
362
|
+
return [cases[0], []]; // None case
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
const innerValue = v instanceof Some ? v.value : v;
|
|
366
|
+
return [cases[1], [innerValue]]; // Some case
|
|
367
|
+
}
|
|
368
|
+
}
|
|
354
369
|
const case_ = cases[v.tag];
|
|
355
370
|
if (case_ == null) {
|
|
356
371
|
throw new Exception(`Cannot find case ${v.name} in union type`);
|
|
@@ -380,6 +395,10 @@ export function makeUnion(uci, values) {
|
|
|
380
395
|
if (values.length !== expectedLength) {
|
|
381
396
|
throw new Exception(`Expected an array of length ${expectedLength} but got ${values.length}`);
|
|
382
397
|
}
|
|
398
|
+
// Special handling for option types
|
|
399
|
+
if (uci.declaringType.fullname === "Microsoft.FSharp.Core.FSharpOption`1") {
|
|
400
|
+
return uci.tag === 0 ? undefined : some(values[0]);
|
|
401
|
+
}
|
|
383
402
|
const construct = uci.declaringType.construct;
|
|
384
403
|
if (construct == null) {
|
|
385
404
|
return {};
|
package/Seq.js
CHANGED
|
@@ -5,8 +5,9 @@ import { class_type } from "./Reflection.js";
|
|
|
5
5
|
import { some, value as value_1 } from "./Option.js";
|
|
6
6
|
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
7
7
|
import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.js";
|
|
8
|
-
import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoice as randomChoice_1, randomChoiceWith as randomChoiceWith_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1,
|
|
8
|
+
import { randomSampleBy as randomSampleBy_1, randomChoicesBy as randomChoicesBy_1, randomChoice as randomChoice_1, randomChoiceWith as randomChoiceWith_1, randomChoiceBy as randomChoiceBy_1, randomShuffleInPlaceBy, chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, item as item_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.js";
|
|
9
9
|
import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.js";
|
|
10
|
+
import { min as min_1 } from "./Double.js";
|
|
10
11
|
import { SR_indexOutOfBounds } from "./Global.js";
|
|
11
12
|
import { nonSeeded } from "./Random.js";
|
|
12
13
|
export const SR_enumerationAlreadyFinished = "Enumeration already finished.";
|
|
@@ -656,7 +657,14 @@ export function fold2(folder, state, xs, ys) {
|
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
659
|
export function foldBack2(folder, xs, ys, state) {
|
|
659
|
-
|
|
660
|
+
const xs_1 = toArray(xs);
|
|
661
|
+
const ys_1 = toArray(ys);
|
|
662
|
+
const len = min_1(xs_1.length, ys_1.length) | 0;
|
|
663
|
+
let acc = state;
|
|
664
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
665
|
+
acc = folder(item_1(i, xs_1), item_1(i, ys_1), acc);
|
|
666
|
+
}
|
|
667
|
+
return acc;
|
|
660
668
|
}
|
|
661
669
|
export function forAll(predicate, xs) {
|
|
662
670
|
return !exists((x) => !predicate(x), xs);
|
package/Set.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { record_type, bool_type, list_type, option_type, class_type } from "./Reflection.js";
|
|
2
|
-
import { some, value as
|
|
2
|
+
import { some, value as value_2 } from "./Option.js";
|
|
3
3
|
import { structuralHash, toIterator, disposeSafe, getEnumerator, isArrayLike, Exception } from "./Util.js";
|
|
4
4
|
import { Record } from "./Types.js";
|
|
5
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
6
|
import { fold as fold_1, fill, setItem } from "./Array.js";
|
|
7
7
|
import { join } from "./String.js";
|
|
8
8
|
import { NotSupportedException_$ctor_Z721C83C5 } from "./System.js";
|
|
9
|
-
import { exists as exists_1,
|
|
9
|
+
import { skip, truncate, iterateIndexed, exists as exists_1, forAll as forAll_1, fold as fold_3, reduce, iterate as iterate_1, map as map_1 } from "./Seq.js";
|
|
10
10
|
import { HashSet__get_Comparer, HashSet_$ctor_Z6150332D, HashSet } from "./MutableSet.js";
|
|
11
11
|
export class SetTreeLeaf$1 {
|
|
12
12
|
constructor(k) {
|
|
@@ -52,7 +52,7 @@ export function SetTreeModule_countAux(t_mut, acc_mut) {
|
|
|
52
52
|
SetTreeModule_countAux: while (true) {
|
|
53
53
|
const t = t_mut, acc = acc_mut;
|
|
54
54
|
if (t != null) {
|
|
55
|
-
const t2 =
|
|
55
|
+
const t2 = value_2(t);
|
|
56
56
|
if (t2 instanceof SetTreeNode$1) {
|
|
57
57
|
const tn = t2;
|
|
58
58
|
t_mut = SetTreeNode$1__get_Left(tn);
|
|
@@ -77,7 +77,7 @@ export function SetTreeModule_mk(l, k, r) {
|
|
|
77
77
|
let hl;
|
|
78
78
|
const t = l;
|
|
79
79
|
if (t != null) {
|
|
80
|
-
const t2 =
|
|
80
|
+
const t2 = value_2(t);
|
|
81
81
|
hl = ((t2 instanceof SetTreeNode$1) ? ((tn = t2, SetTreeNode$1__get_Height(tn))) : 1);
|
|
82
82
|
}
|
|
83
83
|
else {
|
|
@@ -86,7 +86,7 @@ export function SetTreeModule_mk(l, k, r) {
|
|
|
86
86
|
let hr;
|
|
87
87
|
const t_1 = r;
|
|
88
88
|
if (t_1 != null) {
|
|
89
|
-
const t2_1 =
|
|
89
|
+
const t2_1 = value_2(t_1);
|
|
90
90
|
hr = ((t2_1 instanceof SetTreeNode$1) ? ((tn_1 = t2_1, SetTreeNode$1__get_Height(tn_1))) : 1);
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
@@ -105,7 +105,7 @@ export function SetTreeModule_rebalance(t1, v, t2) {
|
|
|
105
105
|
let t1h;
|
|
106
106
|
const t = t1;
|
|
107
107
|
if (t != null) {
|
|
108
|
-
const t2_1 =
|
|
108
|
+
const t2_1 = value_2(t);
|
|
109
109
|
t1h = ((t2_1 instanceof SetTreeNode$1) ? ((tn = t2_1, SetTreeNode$1__get_Height(tn))) : 1);
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
@@ -114,18 +114,18 @@ export function SetTreeModule_rebalance(t1, v, t2) {
|
|
|
114
114
|
let t2h;
|
|
115
115
|
const t_1 = t2;
|
|
116
116
|
if (t_1 != null) {
|
|
117
|
-
const t2_2 =
|
|
117
|
+
const t2_2 = value_2(t_1);
|
|
118
118
|
t2h = ((t2_2 instanceof SetTreeNode$1) ? ((tn_1 = t2_2, SetTreeNode$1__get_Height(tn_1))) : 1);
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
121
121
|
t2h = 0;
|
|
122
122
|
}
|
|
123
123
|
if (t2h > (t1h + 2)) {
|
|
124
|
-
const matchValue =
|
|
124
|
+
const matchValue = value_2(t2);
|
|
125
125
|
if (matchValue instanceof SetTreeNode$1) {
|
|
126
126
|
const t2$0027 = matchValue;
|
|
127
|
-
if (((t_2 = SetTreeNode$1__get_Left(t2$0027), (t_2 != null) ? ((t2_3 =
|
|
128
|
-
const matchValue_1 =
|
|
127
|
+
if (((t_2 = SetTreeNode$1__get_Left(t2$0027), (t_2 != null) ? ((t2_3 = value_2(t_2), (t2_3 instanceof SetTreeNode$1) ? ((tn_2 = t2_3, SetTreeNode$1__get_Height(tn_2))) : 1)) : 0)) > (t1h + 1)) {
|
|
128
|
+
const matchValue_1 = value_2(SetTreeNode$1__get_Left(t2$0027));
|
|
129
129
|
if (matchValue_1 instanceof SetTreeNode$1) {
|
|
130
130
|
const t2l = matchValue_1;
|
|
131
131
|
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)));
|
|
@@ -143,11 +143,11 @@ export function SetTreeModule_rebalance(t1, v, t2) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
else if (t1h > (t2h + 2)) {
|
|
146
|
-
const matchValue_2 =
|
|
146
|
+
const matchValue_2 = value_2(t1);
|
|
147
147
|
if (matchValue_2 instanceof SetTreeNode$1) {
|
|
148
148
|
const t1$0027 = matchValue_2;
|
|
149
|
-
if (((t_3 = SetTreeNode$1__get_Right(t1$0027), (t_3 != null) ? ((t2_4 =
|
|
150
|
-
const matchValue_3 =
|
|
149
|
+
if (((t_3 = SetTreeNode$1__get_Right(t1$0027), (t_3 != null) ? ((t2_4 = value_2(t_3), (t2_4 instanceof SetTreeNode$1) ? ((tn_3 = t2_4, SetTreeNode$1__get_Height(tn_3))) : 1)) : 0)) > (t2h + 1)) {
|
|
150
|
+
const matchValue_3 = value_2(SetTreeNode$1__get_Right(t1$0027));
|
|
151
151
|
if (matchValue_3 instanceof SetTreeNode$1) {
|
|
152
152
|
const t1r = matchValue_3;
|
|
153
153
|
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));
|
|
@@ -170,7 +170,7 @@ export function SetTreeModule_rebalance(t1, v, t2) {
|
|
|
170
170
|
}
|
|
171
171
|
export function SetTreeModule_add(comparer, k, t) {
|
|
172
172
|
if (t != null) {
|
|
173
|
-
const t2 =
|
|
173
|
+
const t2 = value_2(t);
|
|
174
174
|
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
175
175
|
if (t2 instanceof SetTreeNode$1) {
|
|
176
176
|
const tn = t2;
|
|
@@ -203,9 +203,9 @@ export function SetTreeModule_add(comparer, k, t) {
|
|
|
203
203
|
}
|
|
204
204
|
export function SetTreeModule_balance(comparer, t1, k, t2) {
|
|
205
205
|
if (t1 != null) {
|
|
206
|
-
const t1$0027 =
|
|
206
|
+
const t1$0027 = value_2(t1);
|
|
207
207
|
if (t2 != null) {
|
|
208
|
-
const t2$0027 =
|
|
208
|
+
const t2$0027 = value_2(t2);
|
|
209
209
|
if (t1$0027 instanceof SetTreeNode$1) {
|
|
210
210
|
const t1n = t1$0027;
|
|
211
211
|
if (t2$0027 instanceof SetTreeNode$1) {
|
|
@@ -238,7 +238,7 @@ export function SetTreeModule_balance(comparer, t1, k, t2) {
|
|
|
238
238
|
}
|
|
239
239
|
export function SetTreeModule_split(comparer, pivot, t) {
|
|
240
240
|
if (t != null) {
|
|
241
|
-
const t2 =
|
|
241
|
+
const t2 = value_2(t);
|
|
242
242
|
if (t2 instanceof SetTreeNode$1) {
|
|
243
243
|
const tn = t2;
|
|
244
244
|
const c = comparer.Compare(pivot, SetTreeLeaf$1__get_Key(tn)) | 0;
|
|
@@ -273,7 +273,7 @@ export function SetTreeModule_split(comparer, pivot, t) {
|
|
|
273
273
|
}
|
|
274
274
|
export function SetTreeModule_spliceOutSuccessor(t) {
|
|
275
275
|
if (t != null) {
|
|
276
|
-
const t2 =
|
|
276
|
+
const t2 = value_2(t);
|
|
277
277
|
if (t2 instanceof SetTreeNode$1) {
|
|
278
278
|
const tn = t2;
|
|
279
279
|
if (SetTreeNode$1__get_Left(tn) == null) {
|
|
@@ -294,7 +294,7 @@ export function SetTreeModule_spliceOutSuccessor(t) {
|
|
|
294
294
|
}
|
|
295
295
|
export function SetTreeModule_remove(comparer, k, t) {
|
|
296
296
|
if (t != null) {
|
|
297
|
-
const t2 =
|
|
297
|
+
const t2 = value_2(t);
|
|
298
298
|
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
299
299
|
if (t2 instanceof SetTreeNode$1) {
|
|
300
300
|
const tn = t2;
|
|
@@ -332,7 +332,7 @@ export function SetTreeModule_mem(comparer_mut, k_mut, t_mut) {
|
|
|
332
332
|
SetTreeModule_mem: while (true) {
|
|
333
333
|
const comparer = comparer_mut, k = k_mut, t = t_mut;
|
|
334
334
|
if (t != null) {
|
|
335
|
-
const t2 =
|
|
335
|
+
const t2 = value_2(t);
|
|
336
336
|
const c = comparer.Compare(k, SetTreeLeaf$1__get_Key(t2)) | 0;
|
|
337
337
|
if (t2 instanceof SetTreeNode$1) {
|
|
338
338
|
const tn = t2;
|
|
@@ -366,7 +366,7 @@ export function SetTreeModule_iter(f_mut, t_mut) {
|
|
|
366
366
|
SetTreeModule_iter: while (true) {
|
|
367
367
|
const f = f_mut, t = t_mut;
|
|
368
368
|
if (t != null) {
|
|
369
|
-
const t2 =
|
|
369
|
+
const t2 = value_2(t);
|
|
370
370
|
if (t2 instanceof SetTreeNode$1) {
|
|
371
371
|
const tn = t2;
|
|
372
372
|
SetTreeModule_iter(f, SetTreeNode$1__get_Left(tn));
|
|
@@ -386,7 +386,7 @@ export function SetTreeModule_foldBackOpt(f_mut, t_mut, x_mut) {
|
|
|
386
386
|
SetTreeModule_foldBackOpt: while (true) {
|
|
387
387
|
const f = f_mut, t = t_mut, x = x_mut;
|
|
388
388
|
if (t != null) {
|
|
389
|
-
const t2 =
|
|
389
|
+
const t2 = value_2(t);
|
|
390
390
|
if (t2 instanceof SetTreeNode$1) {
|
|
391
391
|
const tn = t2;
|
|
392
392
|
f_mut = f;
|
|
@@ -411,7 +411,7 @@ export function SetTreeModule_foldOpt(f_mut, x_mut, t_mut) {
|
|
|
411
411
|
SetTreeModule_foldOpt: while (true) {
|
|
412
412
|
const f = f_mut, x = x_mut, t = t_mut;
|
|
413
413
|
if (t != null) {
|
|
414
|
-
const t2 =
|
|
414
|
+
const t2 = value_2(t);
|
|
415
415
|
if (t2 instanceof SetTreeNode$1) {
|
|
416
416
|
const tn = t2;
|
|
417
417
|
f_mut = f;
|
|
@@ -436,7 +436,7 @@ export function SetTreeModule_forall(f_mut, t_mut) {
|
|
|
436
436
|
SetTreeModule_forall: while (true) {
|
|
437
437
|
const f = f_mut, t = t_mut;
|
|
438
438
|
if (t != null) {
|
|
439
|
-
const t2 =
|
|
439
|
+
const t2 = value_2(t);
|
|
440
440
|
if (t2 instanceof SetTreeNode$1) {
|
|
441
441
|
const tn = t2;
|
|
442
442
|
if (f(SetTreeLeaf$1__get_Key(tn)) && SetTreeModule_forall(f, SetTreeNode$1__get_Left(tn))) {
|
|
@@ -462,7 +462,7 @@ export function SetTreeModule_exists(f_mut, t_mut) {
|
|
|
462
462
|
SetTreeModule_exists: while (true) {
|
|
463
463
|
const f = f_mut, t = t_mut;
|
|
464
464
|
if (t != null) {
|
|
465
|
-
const t2 =
|
|
465
|
+
const t2 = value_2(t);
|
|
466
466
|
if (t2 instanceof SetTreeNode$1) {
|
|
467
467
|
const tn = t2;
|
|
468
468
|
if (f(SetTreeLeaf$1__get_Key(tn)) ? true : SetTreeModule_exists(f, SetTreeNode$1__get_Left(tn))) {
|
|
@@ -499,7 +499,7 @@ export function SetTreeModule_filterAux(comparer_mut, f_mut, t_mut, acc_mut) {
|
|
|
499
499
|
SetTreeModule_filterAux: while (true) {
|
|
500
500
|
const comparer = comparer_mut, f = f_mut, t = t_mut, acc = acc_mut;
|
|
501
501
|
if (t != null) {
|
|
502
|
-
const t2 =
|
|
502
|
+
const t2 = value_2(t);
|
|
503
503
|
if (t2 instanceof SetTreeNode$1) {
|
|
504
504
|
const tn = t2;
|
|
505
505
|
const acc_1 = f(SetTreeLeaf$1__get_Key(tn)) ? SetTreeModule_add(comparer, SetTreeLeaf$1__get_Key(tn), acc) : acc;
|
|
@@ -532,7 +532,7 @@ export function SetTreeModule_diffAux(comparer_mut, t_mut, acc_mut) {
|
|
|
532
532
|
return acc;
|
|
533
533
|
}
|
|
534
534
|
else if (t != null) {
|
|
535
|
-
const t2 =
|
|
535
|
+
const t2 = value_2(t);
|
|
536
536
|
if (t2 instanceof SetTreeNode$1) {
|
|
537
537
|
const tn = t2;
|
|
538
538
|
comparer_mut = comparer;
|
|
@@ -555,9 +555,9 @@ export function SetTreeModule_diff(comparer, a, b) {
|
|
|
555
555
|
}
|
|
556
556
|
export function SetTreeModule_union(comparer, t1, t2) {
|
|
557
557
|
if (t1 != null) {
|
|
558
|
-
const t1$0027 =
|
|
558
|
+
const t1$0027 = value_2(t1);
|
|
559
559
|
if (t2 != null) {
|
|
560
|
-
const t2$0027 =
|
|
560
|
+
const t2$0027 = value_2(t2);
|
|
561
561
|
if (t1$0027 instanceof SetTreeNode$1) {
|
|
562
562
|
const t1n = t1$0027;
|
|
563
563
|
if (t2$0027 instanceof SetTreeNode$1) {
|
|
@@ -591,7 +591,7 @@ export function SetTreeModule_intersectionAux(comparer_mut, b_mut, t_mut, acc_mu
|
|
|
591
591
|
SetTreeModule_intersectionAux: while (true) {
|
|
592
592
|
const comparer = comparer_mut, b = b_mut, t = t_mut, acc = acc_mut;
|
|
593
593
|
if (t != null) {
|
|
594
|
-
const t2 =
|
|
594
|
+
const t2 = value_2(t);
|
|
595
595
|
if (t2 instanceof SetTreeNode$1) {
|
|
596
596
|
const tn = t2;
|
|
597
597
|
const acc_1 = SetTreeModule_intersectionAux(comparer, b, SetTreeNode$1__get_Right(tn), acc);
|
|
@@ -631,7 +631,7 @@ export function SetTreeModule_partitionAux(comparer_mut, f_mut, t_mut, acc__mut,
|
|
|
631
631
|
const comparer = comparer_mut, f = f_mut, t = t_mut, acc_ = acc__mut, acc__1 = acc__1_mut;
|
|
632
632
|
const acc = [acc_, acc__1];
|
|
633
633
|
if (t != null) {
|
|
634
|
-
const t2 =
|
|
634
|
+
const t2 = value_2(t);
|
|
635
635
|
if (t2 instanceof SetTreeNode$1) {
|
|
636
636
|
const tn = t2;
|
|
637
637
|
const acc_1 = SetTreeModule_partitionAux(comparer, f, SetTreeNode$1__get_Right(tn), acc[0], acc[1]);
|
|
@@ -660,7 +660,7 @@ export function SetTreeModule_minimumElementAux(t_mut, n_mut) {
|
|
|
660
660
|
SetTreeModule_minimumElementAux: while (true) {
|
|
661
661
|
const t = t_mut, n = n_mut;
|
|
662
662
|
if (t != null) {
|
|
663
|
-
const t2 =
|
|
663
|
+
const t2 = value_2(t);
|
|
664
664
|
if (t2 instanceof SetTreeNode$1) {
|
|
665
665
|
const tn = t2;
|
|
666
666
|
t_mut = SetTreeNode$1__get_Left(tn);
|
|
@@ -679,7 +679,7 @@ export function SetTreeModule_minimumElementAux(t_mut, n_mut) {
|
|
|
679
679
|
}
|
|
680
680
|
export function SetTreeModule_minimumElementOpt(t) {
|
|
681
681
|
if (t != null) {
|
|
682
|
-
const t2 =
|
|
682
|
+
const t2 = value_2(t);
|
|
683
683
|
if (t2 instanceof SetTreeNode$1) {
|
|
684
684
|
const tn = t2;
|
|
685
685
|
return some(SetTreeModule_minimumElementAux(SetTreeNode$1__get_Left(tn), SetTreeLeaf$1__get_Key(tn)));
|
|
@@ -696,7 +696,7 @@ export function SetTreeModule_maximumElementAux(t_mut, n_mut) {
|
|
|
696
696
|
SetTreeModule_maximumElementAux: while (true) {
|
|
697
697
|
const t = t_mut, n = n_mut;
|
|
698
698
|
if (t != null) {
|
|
699
|
-
const t2 =
|
|
699
|
+
const t2 = value_2(t);
|
|
700
700
|
if (t2 instanceof SetTreeNode$1) {
|
|
701
701
|
const tn = t2;
|
|
702
702
|
t_mut = SetTreeNode$1__get_Right(tn);
|
|
@@ -715,7 +715,7 @@ export function SetTreeModule_maximumElementAux(t_mut, n_mut) {
|
|
|
715
715
|
}
|
|
716
716
|
export function SetTreeModule_maximumElementOpt(t) {
|
|
717
717
|
if (t != null) {
|
|
718
|
-
const t2 =
|
|
718
|
+
const t2 = value_2(t);
|
|
719
719
|
if (t2 instanceof SetTreeNode$1) {
|
|
720
720
|
const tn = t2;
|
|
721
721
|
return some(SetTreeModule_maximumElementAux(SetTreeNode$1__get_Right(tn), SetTreeLeaf$1__get_Key(tn)));
|
|
@@ -734,7 +734,7 @@ export function SetTreeModule_minimumElement(s) {
|
|
|
734
734
|
throw new Exception("Set contains no elements");
|
|
735
735
|
}
|
|
736
736
|
else {
|
|
737
|
-
return
|
|
737
|
+
return value_2(matchValue);
|
|
738
738
|
}
|
|
739
739
|
}
|
|
740
740
|
export function SetTreeModule_maximumElement(s) {
|
|
@@ -743,7 +743,7 @@ export function SetTreeModule_maximumElement(s) {
|
|
|
743
743
|
throw new Exception("Set contains no elements");
|
|
744
744
|
}
|
|
745
745
|
else {
|
|
746
|
-
return
|
|
746
|
+
return value_2(matchValue);
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
export class SetTreeModule_SetIterator$1 extends Record {
|
|
@@ -763,7 +763,7 @@ export function SetTreeModule_collapseLHS(stack_mut) {
|
|
|
763
763
|
const x = head(stack);
|
|
764
764
|
const rest = tail(stack);
|
|
765
765
|
if (x != null) {
|
|
766
|
-
const x2 =
|
|
766
|
+
const x2 = value_2(x);
|
|
767
767
|
if (x2 instanceof SetTreeNode$1) {
|
|
768
768
|
const xn = x2;
|
|
769
769
|
stack_mut = ofArrayWithTail([SetTreeNode$1__get_Left(xn), SetTreeLeaf$1_$ctor_2B595(SetTreeLeaf$1__get_Key(xn)), SetTreeNode$1__get_Right(xn)], rest);
|
|
@@ -800,7 +800,7 @@ export function SetTreeModule_current(i) {
|
|
|
800
800
|
return SetTreeModule_alreadyFinished();
|
|
801
801
|
}
|
|
802
802
|
else if (head(matchValue) != null) {
|
|
803
|
-
const t =
|
|
803
|
+
const t = value_2(head(matchValue));
|
|
804
804
|
return SetTreeLeaf$1__get_Key(t);
|
|
805
805
|
}
|
|
806
806
|
else {
|
|
@@ -816,7 +816,7 @@ export function SetTreeModule_moveNext(i) {
|
|
|
816
816
|
const matchValue = i.stack;
|
|
817
817
|
if (!isEmpty_1(matchValue)) {
|
|
818
818
|
if (head(matchValue) != null) {
|
|
819
|
-
const t =
|
|
819
|
+
const t = value_2(head(matchValue));
|
|
820
820
|
if (t instanceof SetTreeNode$1) {
|
|
821
821
|
throw new Exception("Please report error: Set iterator, unexpected stack for moveNext");
|
|
822
822
|
}
|
|
@@ -867,8 +867,8 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
867
867
|
if (!isEmpty_1(l2)) {
|
|
868
868
|
if (head(l2) != null) {
|
|
869
869
|
if (head(l1) != null) {
|
|
870
|
-
const x1_3 =
|
|
871
|
-
const x2_3 =
|
|
870
|
+
const x1_3 = value_2(head(l1));
|
|
871
|
+
const x2_3 = value_2(head(l2));
|
|
872
872
|
if (x1_3 instanceof SetTreeNode$1) {
|
|
873
873
|
const x1n_2 = x1_3;
|
|
874
874
|
if (SetTreeNode$1__get_Left(x1n_2) == null) {
|
|
@@ -892,13 +892,13 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
892
892
|
if (head(l1) != null) {
|
|
893
893
|
matchResult = 0;
|
|
894
894
|
t1_6 = tail(l1);
|
|
895
|
-
x1_4 =
|
|
895
|
+
x1_4 = value_2(head(l1));
|
|
896
896
|
}
|
|
897
897
|
else if (!isEmpty_1(l2)) {
|
|
898
898
|
if (head(l2) != null) {
|
|
899
899
|
matchResult = 1;
|
|
900
900
|
t2_6 = tail(l2);
|
|
901
|
-
x2_4 =
|
|
901
|
+
x2_4 = value_2(head(l2));
|
|
902
902
|
}
|
|
903
903
|
else {
|
|
904
904
|
matchResult = 2;
|
|
@@ -912,7 +912,7 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
912
912
|
if (head(l2) != null) {
|
|
913
913
|
matchResult = 1;
|
|
914
914
|
t2_6 = tail(l2);
|
|
915
|
-
x2_4 =
|
|
915
|
+
x2_4 = value_2(head(l2));
|
|
916
916
|
}
|
|
917
917
|
else {
|
|
918
918
|
matchResult = 2;
|
|
@@ -974,13 +974,13 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
974
974
|
if (head(l1) != null) {
|
|
975
975
|
matchResult_1 = 0;
|
|
976
976
|
t1_7 = tail(l1);
|
|
977
|
-
x1_5 =
|
|
977
|
+
x1_5 = value_2(head(l1));
|
|
978
978
|
}
|
|
979
979
|
else if (!isEmpty_1(l2)) {
|
|
980
980
|
if (head(l2) != null) {
|
|
981
981
|
matchResult_1 = 1;
|
|
982
982
|
t2_7 = tail(l2);
|
|
983
|
-
x2_5 =
|
|
983
|
+
x2_5 = value_2(head(l2));
|
|
984
984
|
}
|
|
985
985
|
else {
|
|
986
986
|
matchResult_1 = 2;
|
|
@@ -994,7 +994,7 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
994
994
|
if (head(l2) != null) {
|
|
995
995
|
matchResult_1 = 1;
|
|
996
996
|
t2_7 = tail(l2);
|
|
997
|
-
x2_5 =
|
|
997
|
+
x2_5 = value_2(head(l2));
|
|
998
998
|
}
|
|
999
999
|
else {
|
|
1000
1000
|
matchResult_1 = 2;
|
|
@@ -1057,13 +1057,13 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1057
1057
|
if (head(l1) != null) {
|
|
1058
1058
|
matchResult_2 = 0;
|
|
1059
1059
|
t1_8 = tail(l1);
|
|
1060
|
-
x1_6 =
|
|
1060
|
+
x1_6 = value_2(head(l1));
|
|
1061
1061
|
}
|
|
1062
1062
|
else if (!isEmpty_1(l2)) {
|
|
1063
1063
|
if (head(l2) != null) {
|
|
1064
1064
|
matchResult_2 = 1;
|
|
1065
1065
|
t2_8 = tail(l2);
|
|
1066
|
-
x2_6 =
|
|
1066
|
+
x2_6 = value_2(head(l2));
|
|
1067
1067
|
}
|
|
1068
1068
|
else {
|
|
1069
1069
|
matchResult_2 = 2;
|
|
@@ -1077,7 +1077,7 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1077
1077
|
if (head(l2) != null) {
|
|
1078
1078
|
matchResult_2 = 1;
|
|
1079
1079
|
t2_8 = tail(l2);
|
|
1080
|
-
x2_6 =
|
|
1080
|
+
x2_6 = value_2(head(l2));
|
|
1081
1081
|
}
|
|
1082
1082
|
else {
|
|
1083
1083
|
matchResult_2 = 2;
|
|
@@ -1134,19 +1134,19 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1134
1134
|
}
|
|
1135
1135
|
}
|
|
1136
1136
|
else {
|
|
1137
|
-
const x2 =
|
|
1137
|
+
const x2 = value_2(head(l2));
|
|
1138
1138
|
let matchResult_3 = undefined, t1_2 = undefined, x1 = undefined, t2_2 = undefined, x2_1 = undefined;
|
|
1139
1139
|
if (!isEmpty_1(l1)) {
|
|
1140
1140
|
if (head(l1) != null) {
|
|
1141
1141
|
matchResult_3 = 0;
|
|
1142
1142
|
t1_2 = tail(l1);
|
|
1143
|
-
x1 =
|
|
1143
|
+
x1 = value_2(head(l1));
|
|
1144
1144
|
}
|
|
1145
1145
|
else if (!isEmpty_1(l2)) {
|
|
1146
1146
|
if (head(l2) != null) {
|
|
1147
1147
|
matchResult_3 = 1;
|
|
1148
1148
|
t2_2 = tail(l2);
|
|
1149
|
-
x2_1 =
|
|
1149
|
+
x2_1 = value_2(head(l2));
|
|
1150
1150
|
}
|
|
1151
1151
|
else {
|
|
1152
1152
|
matchResult_3 = 2;
|
|
@@ -1160,7 +1160,7 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1160
1160
|
if (head(l2) != null) {
|
|
1161
1161
|
matchResult_3 = 1;
|
|
1162
1162
|
t2_2 = tail(l2);
|
|
1163
|
-
x2_1 =
|
|
1163
|
+
x2_1 = value_2(head(l2));
|
|
1164
1164
|
}
|
|
1165
1165
|
else {
|
|
1166
1166
|
matchResult_3 = 2;
|
|
@@ -1204,19 +1204,19 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
else if (head(l1) != null) {
|
|
1207
|
-
const x1_1 =
|
|
1207
|
+
const x1_1 = value_2(head(l1));
|
|
1208
1208
|
let matchResult_4 = undefined, t1_4 = undefined, x1_2 = undefined, t2_4 = undefined, x2_2 = undefined;
|
|
1209
1209
|
if (!isEmpty_1(l1)) {
|
|
1210
1210
|
if (head(l1) != null) {
|
|
1211
1211
|
matchResult_4 = 0;
|
|
1212
1212
|
t1_4 = tail(l1);
|
|
1213
|
-
x1_2 =
|
|
1213
|
+
x1_2 = value_2(head(l1));
|
|
1214
1214
|
}
|
|
1215
1215
|
else if (!isEmpty_1(l2)) {
|
|
1216
1216
|
if (head(l2) != null) {
|
|
1217
1217
|
matchResult_4 = 1;
|
|
1218
1218
|
t2_4 = tail(l2);
|
|
1219
|
-
x2_2 =
|
|
1219
|
+
x2_2 = value_2(head(l2));
|
|
1220
1220
|
}
|
|
1221
1221
|
else {
|
|
1222
1222
|
matchResult_4 = 2;
|
|
@@ -1230,7 +1230,7 @@ export function SetTreeModule_compareStacks(comparer_mut, l1_mut, l2_mut) {
|
|
|
1230
1230
|
if (head(l2) != null) {
|
|
1231
1231
|
matchResult_4 = 1;
|
|
1232
1232
|
t2_4 = tail(l2);
|
|
1233
|
-
x2_2 =
|
|
1233
|
+
x2_2 = value_2(head(l2));
|
|
1234
1234
|
}
|
|
1235
1235
|
else {
|
|
1236
1236
|
matchResult_4 = 2;
|
|
@@ -1316,7 +1316,7 @@ export function SetTreeModule_toList(t) {
|
|
|
1316
1316
|
loop: while (true) {
|
|
1317
1317
|
const t$0027 = t$0027_mut, acc = acc_mut;
|
|
1318
1318
|
if (t$0027 != null) {
|
|
1319
|
-
const t2 =
|
|
1319
|
+
const t2 = value_2(t$0027);
|
|
1320
1320
|
if (t2 instanceof SetTreeNode$1) {
|
|
1321
1321
|
const tn = t2;
|
|
1322
1322
|
t$0027_mut = SetTreeNode$1__get_Left(tn);
|
|
@@ -1778,11 +1778,39 @@ export function isProperSubsetOf(s1, s2) {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
}
|
|
1780
1780
|
export function isProperSupersetOf(s1, s2) {
|
|
1781
|
-
const s2_1 =
|
|
1782
|
-
if (
|
|
1783
|
-
return forAll_1((
|
|
1781
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1782
|
+
if (s1.size > s2_1.size) {
|
|
1783
|
+
return forAll_1((value) => s1.has(value), s2_1.values());
|
|
1784
1784
|
}
|
|
1785
1785
|
else {
|
|
1786
1786
|
return false;
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
|
+
export function symmetricExceptWith(s1, s2) {
|
|
1790
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1791
|
+
iterate_1((x) => {
|
|
1792
|
+
if (s1.has(x)) {
|
|
1793
|
+
s1.delete(x);
|
|
1794
|
+
}
|
|
1795
|
+
else {
|
|
1796
|
+
s1.add(x);
|
|
1797
|
+
}
|
|
1798
|
+
}, s2_1.values());
|
|
1799
|
+
}
|
|
1800
|
+
export function overlaps(s1, s2) {
|
|
1801
|
+
return exists_1((value) => s1.has(value), s2);
|
|
1802
|
+
}
|
|
1803
|
+
export function setEquals(s1, s2) {
|
|
1804
|
+
const s2_1 = newMutableSetWith(s1, s2);
|
|
1805
|
+
if (s1.size === s2_1.size) {
|
|
1806
|
+
return forAll_1((value) => s2_1.has(value), s1.values());
|
|
1807
|
+
}
|
|
1808
|
+
else {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
export function copyToArray(s1, target, sourceIndex, targetIndex, count_1) {
|
|
1813
|
+
iterateIndexed((index, value) => {
|
|
1814
|
+
setItem(target, targetIndex + index, value);
|
|
1815
|
+
}, truncate(count_1, skip(sourceIndex, s1.values())));
|
|
1816
|
+
}
|
package/String.js
CHANGED
|
@@ -84,6 +84,18 @@ export function endsWith(str, pattern, ic) {
|
|
|
84
84
|
}
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
|
+
export function contains(str, pattern, ic) {
|
|
88
|
+
if (ic === StringComparison.Ordinal) { // fast path
|
|
89
|
+
return str.includes(pattern);
|
|
90
|
+
}
|
|
91
|
+
const len = pattern.length;
|
|
92
|
+
for (let i = 0; i <= str.length - len; i++) {
|
|
93
|
+
if (cmp(str.slice(i, i + len), pattern, ic) === 0) {
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
87
99
|
export function indexOfAny(str, anyOf, ...args) {
|
|
88
100
|
if (str == null || str === "") {
|
|
89
101
|
return -1;
|
|
@@ -370,11 +382,24 @@ export function format(str, ...args) {
|
|
|
370
382
|
}
|
|
371
383
|
break;
|
|
372
384
|
case "g":
|
|
373
|
-
case "G":
|
|
385
|
+
case "G": {
|
|
374
386
|
rep = precision != null ? toPrecision(rep, precision) : toPrecision(rep);
|
|
375
|
-
//
|
|
376
|
-
|
|
387
|
+
// Handle exponential notation: only trim trailing zeros from mantissa, not from exponent.
|
|
388
|
+
// .NET G format guarantees an exponent of at least 2 digits with an explicit sign (e.g. "E-07").
|
|
389
|
+
const eIdx = rep.indexOf("e");
|
|
390
|
+
if (eIdx >= 0) {
|
|
391
|
+
const mantissa = trimEnd(trimEnd(rep.slice(0, eIdx), "0"), ".");
|
|
392
|
+
const expSign = rep[eIdx + 1]; // toPrecision always emits "+" or "-"
|
|
393
|
+
const expDigits = rep.slice(eIdx + 2);
|
|
394
|
+
const paddedExpDigits = expDigits.length < 2 ? "0" + expDigits : expDigits;
|
|
395
|
+
const eChar = format === "G" ? "E" : "e";
|
|
396
|
+
rep = mantissa + eChar + expSign + paddedExpDigits;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
rep = trimEnd(trimEnd(rep, "0"), ".");
|
|
400
|
+
}
|
|
377
401
|
break;
|
|
402
|
+
}
|
|
378
403
|
case "n":
|
|
379
404
|
case "N":
|
|
380
405
|
precision = precision != null ? precision : 2;
|
|
@@ -407,7 +432,7 @@ export function format(str, ...args) {
|
|
|
407
432
|
if (!isIntegral(rep)) {
|
|
408
433
|
throw new Exception("Format specifier was invalid.");
|
|
409
434
|
}
|
|
410
|
-
precision = precision != null ? precision :
|
|
435
|
+
precision = precision != null ? precision : 1;
|
|
411
436
|
rep = padLeft(toHex(rep), precision, "0");
|
|
412
437
|
if (format === "X") {
|
|
413
438
|
rep = rep.toUpperCase();
|
package/System.Text.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.js";
|
|
2
2
|
import { class_type } from "./Reflection.js";
|
|
3
3
|
import { toString } from "./Types.js";
|
|
4
|
-
import { Exception, clear, int32ToString } from "./Util.js";
|
|
4
|
+
import { Exception, clear, int64ToString, int32ToString, int16ToString } from "./Util.js";
|
|
5
5
|
import { setItem, item } from "./Array.js";
|
|
6
6
|
export class StringBuilder {
|
|
7
7
|
constructor(value, capacity) {
|
|
@@ -47,10 +47,42 @@ export function StringBuilder__Append_61B1CA(x, c, repeatCount) {
|
|
|
47
47
|
void (x.buf.push(s));
|
|
48
48
|
return x;
|
|
49
49
|
}
|
|
50
|
+
export function StringBuilder__Append_Z510FF069(x, o) {
|
|
51
|
+
void (x.buf.push(o.toString()));
|
|
52
|
+
return x;
|
|
53
|
+
}
|
|
54
|
+
export function StringBuilder__Append_244D3E44(x, o) {
|
|
55
|
+
void (x.buf.push(o.toString()));
|
|
56
|
+
return x;
|
|
57
|
+
}
|
|
58
|
+
export function StringBuilder__Append_Z524259E6(x, o) {
|
|
59
|
+
void (x.buf.push(int16ToString(o)));
|
|
60
|
+
return x;
|
|
61
|
+
}
|
|
62
|
+
export function StringBuilder__Append_Z6EF82811(x, o) {
|
|
63
|
+
void (x.buf.push(o.toString()));
|
|
64
|
+
return x;
|
|
65
|
+
}
|
|
50
66
|
export function StringBuilder__Append_Z524259A4(x, o) {
|
|
51
67
|
void (x.buf.push(int32ToString(o)));
|
|
52
68
|
return x;
|
|
53
69
|
}
|
|
70
|
+
export function StringBuilder__Append_Z6EF827D7(x, o) {
|
|
71
|
+
void (x.buf.push(o.toString()));
|
|
72
|
+
return x;
|
|
73
|
+
}
|
|
74
|
+
export function StringBuilder__Append_Z524259C1(x, o) {
|
|
75
|
+
void (x.buf.push(int64ToString(o)));
|
|
76
|
+
return x;
|
|
77
|
+
}
|
|
78
|
+
export function StringBuilder__Append_Z6EF827B6(x, o) {
|
|
79
|
+
void (x.buf.push(o.toString()));
|
|
80
|
+
return x;
|
|
81
|
+
}
|
|
82
|
+
export function StringBuilder__Append_Z7138B98C(x, o) {
|
|
83
|
+
void (x.buf.push(o.toString()));
|
|
84
|
+
return x;
|
|
85
|
+
}
|
|
54
86
|
export function StringBuilder__Append_5E38073B(x, o) {
|
|
55
87
|
void (x.buf.push(o.toString()));
|
|
56
88
|
return x;
|
package/package.json
CHANGED