@fable-org/fable-library-ts 2.0.0-beta.4 → 2.0.0-beta.5
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/Array.ts +253 -247
- package/Async.ts +13 -12
- package/AsyncBuilder.ts +10 -11
- package/BigInt.ts +6 -6
- package/BitConverter.ts +3 -3
- package/Boolean.ts +3 -2
- package/CHANGELOG.md +8 -0
- package/Char.ts +38 -35
- package/Choice.ts +36 -12
- package/CollectionUtil.ts +4 -4
- package/Date.ts +67 -62
- package/DateOffset.ts +48 -57
- package/DateOnly.ts +8 -8
- package/Decimal.ts +9 -9
- package/Double.ts +3 -2
- package/Encoding.ts +1 -1
- package/Event.ts +3 -3
- package/FSharp.Collections.ts +31 -13
- package/FSharp.Core.CompilerServices.ts +4 -4
- package/FSharp.Core.ts +34 -34
- package/Global.ts +44 -2
- package/Guid.ts +7 -6
- package/Int32.ts +20 -17
- package/List.ts +57 -56
- package/Long.ts +6 -5
- package/MailboxProcessor.ts +8 -7
- package/Map.ts +67 -65
- package/MapUtil.ts +5 -5
- package/MutableMap.ts +32 -20
- package/MutableSet.ts +12 -12
- package/Native.ts +3 -3
- package/Numeric.ts +1 -1
- package/Observable.ts +3 -3
- package/Option.ts +3 -3
- package/Random.ts +34 -34
- package/Range.ts +7 -7
- package/Reflection.ts +73 -40
- package/RegExp.ts +5 -3
- package/Result.ts +31 -27
- package/Seq.ts +56 -54
- package/Seq2.ts +14 -14
- package/Set.ts +81 -80
- package/String.ts +41 -38
- package/System.Collections.Generic.ts +45 -25
- package/System.Text.ts +12 -12
- package/System.ts +366 -0
- package/TimeOnly.ts +10 -10
- package/TimeSpan.ts +11 -11
- package/Timer.ts +2 -2
- package/Types.ts +1 -19
- package/Uri.ts +13 -10
- package/Util.ts +74 -26
- package/package.json +1 -1
- package/tsconfig.json +18 -5
- package/SystemException.ts +0 -7
package/List.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { join } from "./String.
|
|
3
|
-
import { defaultArg, some, value as value_1, Option } from "./Option.
|
|
4
|
-
import { IComparer, IEqualityComparer, disposeSafe, isArrayLike, IDisposable, defaultOf, toIterator, getEnumerator, IEnumerator, compare, structuralHash,
|
|
5
|
-
import { int32 } from "./Int32.
|
|
6
|
-
import { Record } from "./Types.
|
|
7
|
-
import { class_type, record_type, option_type, TypeInfo } from "./Reflection.
|
|
8
|
-
import { SR_inputSequenceTooLong, SR_inputSequenceEmpty, SR_inputMustBeNonNegative, SR_notEnoughElements, SR_differentLengths, SR_keyNotFoundAlt, SR_indexOutOfBounds, SR_inputWasEmpty } from "./Global.
|
|
9
|
-
import {
|
|
2
|
+
import { join } from "./String.ts";
|
|
3
|
+
import { defaultArg, some, value as value_1, Option } from "./Option.ts";
|
|
4
|
+
import { IComparer, IEqualityComparer, disposeSafe, isArrayLike, MutableArray, Exception, IDisposable, defaultOf, toIterator, getEnumerator, IEnumerator, compare, structuralHash, equals } from "./Util.ts";
|
|
5
|
+
import { int32 } from "./Int32.ts";
|
|
6
|
+
import { Record } from "./Types.ts";
|
|
7
|
+
import { class_type, record_type, option_type, TypeInfo } from "./Reflection.ts";
|
|
8
|
+
import { SR_inputSequenceTooLong, SR_inputSequenceEmpty, SR_inputMustBeNonNegative, SR_notEnoughElements, SR_differentLengths, SR_keyNotFoundAlt, SR_indexOutOfBounds, SR_inputWasEmpty } from "./Global.ts";
|
|
9
|
+
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.ts";
|
|
10
|
+
import { transpose as transpose_1, splitInto as splitInto_1, windowed as windowed_1, pairwise as pairwise_1, chunkBySize as chunkBySize_1, map as map_1, permute as permute_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, scanBack as scanBack_1, item as item_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, setItem, fill } from "./Array.ts";
|
|
10
11
|
|
|
11
12
|
export class FSharpList<T> extends Record implements Iterable<T> {
|
|
12
13
|
readonly head: T;
|
|
@@ -20,7 +21,7 @@ export class FSharpList<T> extends Record implements Iterable<T> {
|
|
|
20
21
|
const xs: FSharpList<T> = this;
|
|
21
22
|
return ("[" + join("; ", xs)) + "]";
|
|
22
23
|
}
|
|
23
|
-
Equals(other:
|
|
24
|
+
Equals(other: any): boolean {
|
|
24
25
|
const xs: FSharpList<T> = this;
|
|
25
26
|
if (xs === other) {
|
|
26
27
|
return true;
|
|
@@ -96,7 +97,7 @@ export class FSharpList<T> extends Record implements Iterable<T> {
|
|
|
96
97
|
const this$: FSharpList<T> = this;
|
|
97
98
|
return Array.from(this$);
|
|
98
99
|
}
|
|
99
|
-
CompareTo(other:
|
|
100
|
+
CompareTo(other: any): int32 {
|
|
100
101
|
const xs: FSharpList<T> = this;
|
|
101
102
|
if (other instanceof FSharpList) {
|
|
102
103
|
const ys = other as FSharpList<T>;
|
|
@@ -169,7 +170,7 @@ export class ListEnumerator$1<T> implements IEnumerator<T>, IDisposable {
|
|
|
169
170
|
const _: ListEnumerator$1<T> = this;
|
|
170
171
|
return _.current;
|
|
171
172
|
}
|
|
172
|
-
"System.Collections.IEnumerator.get_Current"():
|
|
173
|
+
"System.Collections.IEnumerator.get_Current"(): any {
|
|
173
174
|
const _: ListEnumerator$1<T> = this;
|
|
174
175
|
return _.current;
|
|
175
176
|
}
|
|
@@ -241,7 +242,7 @@ export function FSharpList__get_Head<T>(xs: FSharpList<T>): T {
|
|
|
241
242
|
return xs.head;
|
|
242
243
|
}
|
|
243
244
|
else {
|
|
244
|
-
throw new
|
|
245
|
+
throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
|
|
245
246
|
}
|
|
246
247
|
}
|
|
247
248
|
|
|
@@ -251,7 +252,7 @@ export function FSharpList__get_Tail<T>(xs: FSharpList<T>): FSharpList<T> {
|
|
|
251
252
|
return value_1(matchValue);
|
|
252
253
|
}
|
|
253
254
|
else {
|
|
254
|
-
throw new
|
|
255
|
+
throw new Exception((SR_inputWasEmpty + "\\nParameter name: ") + "list");
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
|
|
@@ -272,7 +273,7 @@ export function FSharpList__get_Item_Z524259A4<T>(xs: FSharpList<T>, index: int3
|
|
|
272
273
|
}
|
|
273
274
|
}
|
|
274
275
|
else {
|
|
275
|
-
throw new
|
|
276
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
276
277
|
}
|
|
277
278
|
break;
|
|
278
279
|
}
|
|
@@ -281,7 +282,7 @@ export function FSharpList__get_Item_Z524259A4<T>(xs: FSharpList<T>, index: int3
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
export function indexNotFound<$a>(): $a {
|
|
284
|
-
throw
|
|
285
|
+
throw KeyNotFoundException_$ctor_Z721C83C5(SR_keyNotFoundAlt);
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
export function empty<$a>(): FSharpList<$a> {
|
|
@@ -345,7 +346,7 @@ export function tryLast<T>(xs_mut: FSharpList<T>): Option<T> {
|
|
|
345
346
|
export function last<T>(xs: FSharpList<T>): T {
|
|
346
347
|
const matchValue: Option<T> = tryLast<T>(xs);
|
|
347
348
|
if (matchValue == null) {
|
|
348
|
-
throw new
|
|
349
|
+
throw new Exception(SR_inputWasEmpty);
|
|
349
350
|
}
|
|
350
351
|
else {
|
|
351
352
|
return value_1(matchValue);
|
|
@@ -387,9 +388,9 @@ export function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), xs: FSha
|
|
|
387
388
|
return loop(xs, ys) | 0;
|
|
388
389
|
}
|
|
389
390
|
|
|
390
|
-
export function toArray<T>(xs: FSharpList<T>): T
|
|
391
|
+
export function toArray<T>(xs: FSharpList<T>): MutableArray<T> {
|
|
391
392
|
const len: int32 = FSharpList__get_Length<T>(xs) | 0;
|
|
392
|
-
const res: T
|
|
393
|
+
const res: MutableArray<T> = fill(new Array(len), 0, len, null);
|
|
393
394
|
const loop = (i_mut: int32, xs_1_mut: FSharpList<T>): void => {
|
|
394
395
|
loop:
|
|
395
396
|
while (true) {
|
|
@@ -466,7 +467,7 @@ export function unfold<State, T>(generator: ((arg0: State) => Option<[T, State]>
|
|
|
466
467
|
loop:
|
|
467
468
|
while (true) {
|
|
468
469
|
const acc: State = acc_mut, node: FSharpList<T> = node_mut;
|
|
469
|
-
let t: FSharpList<T
|
|
470
|
+
let t: FSharpList<T> = undefined as any;
|
|
470
471
|
const matchValue: Option<[T, State]> = generator(acc);
|
|
471
472
|
if (matchValue != null) {
|
|
472
473
|
acc_mut = value_1(matchValue)[1];
|
|
@@ -516,7 +517,7 @@ export function toSeq<T>(xs: FSharpList<T>): Iterable<T> {
|
|
|
516
517
|
return xs;
|
|
517
518
|
}
|
|
518
519
|
|
|
519
|
-
export function ofArrayWithTail<T>(xs: T
|
|
520
|
+
export function ofArrayWithTail<T>(xs: MutableArray<T>, tail_1: FSharpList<T>): FSharpList<T> {
|
|
520
521
|
let res: FSharpList<T> = tail_1;
|
|
521
522
|
for (let i: int32 = xs.length - 1; i >= 0; i--) {
|
|
522
523
|
res = FSharpList_Cons_305B8EAC<T>(item_1(i, xs), res);
|
|
@@ -524,7 +525,7 @@ export function ofArrayWithTail<T>(xs: T[], tail_1: FSharpList<T>): FSharpList<T
|
|
|
524
525
|
return res;
|
|
525
526
|
}
|
|
526
527
|
|
|
527
|
-
export function ofArray<T>(xs: T
|
|
528
|
+
export function ofArray<T>(xs: MutableArray<T>): FSharpList<T> {
|
|
528
529
|
return ofArrayWithTail<T>(xs, FSharpList_get_Empty<T>());
|
|
529
530
|
}
|
|
530
531
|
|
|
@@ -541,7 +542,7 @@ export function ofSeq<T>(xs: Iterable<T>): FSharpList<T> {
|
|
|
541
542
|
const enumerator: IEnumerator<T> = getEnumerator(xs);
|
|
542
543
|
try {
|
|
543
544
|
while (enumerator["System.Collections.IEnumerator.MoveNext"]()) {
|
|
544
|
-
let xs_3: FSharpList<T
|
|
545
|
+
let xs_3: FSharpList<T> = (undefined as any), t: FSharpList<T> = (undefined as any);
|
|
545
546
|
const x: T = enumerator["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
546
547
|
node = ((xs_3 = node, (t = (new FSharpList(x, undefined)), (xs_3.tail = t, t))));
|
|
547
548
|
}
|
|
@@ -567,7 +568,7 @@ export function concat<T>(lists: Iterable<FSharpList<T>>): FSharpList<T> {
|
|
|
567
568
|
}, node, xs);
|
|
568
569
|
};
|
|
569
570
|
if (isArrayLike(lists)) {
|
|
570
|
-
const xs_3: FSharpList<T
|
|
571
|
+
const xs_3: MutableArray<FSharpList<T>> = lists;
|
|
571
572
|
xs_3.forEach(action);
|
|
572
573
|
}
|
|
573
574
|
else if (lists instanceof FSharpList) {
|
|
@@ -599,7 +600,7 @@ export function scan<State, T>(folder: ((arg0: State, arg1: T) => State), state:
|
|
|
599
600
|
let acc: State = state;
|
|
600
601
|
let xs_3: FSharpList<T> = xs;
|
|
601
602
|
while (!FSharpList__get_IsEmpty<T>(xs_3)) {
|
|
602
|
-
let xs_4: FSharpList<State
|
|
603
|
+
let xs_4: FSharpList<State> = (undefined as any), t_2: FSharpList<State> = (undefined as any);
|
|
603
604
|
acc = folder(acc, FSharpList__get_Head<T>(xs_3));
|
|
604
605
|
node = ((xs_4 = node, (t_2 = (new FSharpList(acc, undefined)), (xs_4.tail = t_2, t_2))));
|
|
605
606
|
xs_3 = FSharpList__get_Tail<T>(xs_3);
|
|
@@ -625,7 +626,7 @@ export function collect<T, U>(mapping: ((arg0: T) => FSharpList<U>), xs: FSharpL
|
|
|
625
626
|
while (!FSharpList__get_IsEmpty<T>(ys)) {
|
|
626
627
|
let zs: FSharpList<U> = mapping(FSharpList__get_Head<T>(ys));
|
|
627
628
|
while (!FSharpList__get_IsEmpty<U>(zs)) {
|
|
628
|
-
let xs_1: FSharpList<U
|
|
629
|
+
let xs_1: FSharpList<U> = (undefined as any), t: FSharpList<U> = (undefined as any);
|
|
629
630
|
node = ((xs_1 = node, (t = (new FSharpList(FSharpList__get_Head<U>(zs), undefined)), (xs_1.tail = t, t))));
|
|
630
631
|
zs = FSharpList__get_Tail<U>(zs);
|
|
631
632
|
}
|
|
@@ -682,7 +683,7 @@ export function mapIndexed2<T1, T2, U>(mapping: ((arg0: int32, arg1: T1, arg2: T
|
|
|
682
683
|
loop:
|
|
683
684
|
while (true) {
|
|
684
685
|
const i: int32 = i_mut, acc: FSharpList<U> = acc_mut, xs_1: FSharpList<T1> = xs_1_mut, ys_1: FSharpList<T2> = ys_1_mut;
|
|
685
|
-
let t: FSharpList<U
|
|
686
|
+
let t: FSharpList<U> = undefined as any;
|
|
686
687
|
if (FSharpList__get_IsEmpty<T1>(xs_1) ? true : FSharpList__get_IsEmpty<T2>(ys_1)) {
|
|
687
688
|
return acc;
|
|
688
689
|
}
|
|
@@ -708,7 +709,7 @@ export function map3<T1, T2, T3, U>(mapping: ((arg0: T1, arg1: T2, arg2: T3) =>
|
|
|
708
709
|
loop:
|
|
709
710
|
while (true) {
|
|
710
711
|
const acc: FSharpList<U> = acc_mut, xs_1: FSharpList<T1> = xs_1_mut, ys_1: FSharpList<T2> = ys_1_mut, zs_1: FSharpList<T3> = zs_1_mut;
|
|
711
|
-
let t: FSharpList<U
|
|
712
|
+
let t: FSharpList<U> = undefined as any;
|
|
712
713
|
if ((FSharpList__get_IsEmpty<T1>(xs_1) ? true : FSharpList__get_IsEmpty<T2>(ys_1)) ? true : FSharpList__get_IsEmpty<T3>(zs_1)) {
|
|
713
714
|
return acc;
|
|
714
715
|
}
|
|
@@ -732,7 +733,7 @@ export function map3<T1, T2, T3, U>(mapping: ((arg0: T1, arg1: T2, arg2: T3) =>
|
|
|
732
733
|
export function mapFold<State, T, Result>(mapping: ((arg0: State, arg1: T) => [Result, State]), state: State, xs: FSharpList<T>): [FSharpList<Result>, State] {
|
|
733
734
|
const root: FSharpList<Result> = FSharpList_get_Empty<Result>();
|
|
734
735
|
const patternInput_1: [FSharpList<Result>, State] = fold<T, [FSharpList<Result>, State]>((tupledArg: [FSharpList<Result>, State], x: T): [FSharpList<Result>, State] => {
|
|
735
|
-
let t: FSharpList<Result
|
|
736
|
+
let t: FSharpList<Result> = undefined as any;
|
|
736
737
|
const patternInput: [Result, State] = mapping(tupledArg[1], x);
|
|
737
738
|
return [(t = (new FSharpList(patternInput[0], undefined)), (tupledArg[0].tail = t, t)), patternInput[1]] as [FSharpList<Result>, State];
|
|
738
739
|
}, [root, state] as [FSharpList<Result>, State], xs);
|
|
@@ -903,7 +904,7 @@ export function partition<T>(f: ((arg0: T) => boolean), xs: FSharpList<T>): [FSh
|
|
|
903
904
|
const root2: FSharpList<T> = FSharpList_get_Empty<T>();
|
|
904
905
|
const root1: FSharpList<T> = matchValue;
|
|
905
906
|
const patternInput_1: [FSharpList<T>, FSharpList<T>] = fold<T, [FSharpList<T>, FSharpList<T>]>((tupledArg: [FSharpList<T>, FSharpList<T>], x: T): [FSharpList<T>, FSharpList<T>] => {
|
|
906
|
-
let t: FSharpList<T
|
|
907
|
+
let t: FSharpList<T> = (undefined as any), t_2: FSharpList<T> = (undefined as any);
|
|
907
908
|
const lacc: FSharpList<T> = tupledArg[0];
|
|
908
909
|
const racc: FSharpList<T> = tupledArg[1];
|
|
909
910
|
if (f(x)) {
|
|
@@ -939,14 +940,14 @@ export function choose<T, U>(f: ((arg0: T) => Option<U>), xs: FSharpList<T>): FS
|
|
|
939
940
|
}
|
|
940
941
|
|
|
941
942
|
export function contains<T>(value: T, xs: FSharpList<T>, eq: IEqualityComparer<T>): boolean {
|
|
942
|
-
return tryFindIndex<
|
|
943
|
+
return tryFindIndex<T>((v: T): boolean => eq.Equals(value, v), xs) != null;
|
|
943
944
|
}
|
|
944
945
|
|
|
945
946
|
export function initialize<T>(n: int32, f: ((arg0: int32) => T)): FSharpList<T> {
|
|
946
947
|
const root: FSharpList<T> = FSharpList_get_Empty<T>();
|
|
947
948
|
let node: FSharpList<T> = root;
|
|
948
949
|
for (let i = 0; i <= (n - 1); i++) {
|
|
949
|
-
let xs: FSharpList<T
|
|
950
|
+
let xs: FSharpList<T> = (undefined as any), t: FSharpList<T> = (undefined as any);
|
|
950
951
|
node = ((xs = node, (t = (new FSharpList(f(i), undefined)), (xs.tail = t, t))));
|
|
951
952
|
}
|
|
952
953
|
const xs_2: FSharpList<T> = node;
|
|
@@ -961,7 +962,7 @@ export function replicate<$a>(n: int32, x: $a): FSharpList<$a> {
|
|
|
961
962
|
|
|
962
963
|
export function reduce<T>(f: ((arg0: T, arg1: T) => T), xs: FSharpList<T>): T {
|
|
963
964
|
if (FSharpList__get_IsEmpty<T>(xs)) {
|
|
964
|
-
throw new
|
|
965
|
+
throw new Exception(SR_inputWasEmpty);
|
|
965
966
|
}
|
|
966
967
|
else {
|
|
967
968
|
return fold<T, T>(f, head<T>(xs), tail<T>(xs));
|
|
@@ -970,7 +971,7 @@ export function reduce<T>(f: ((arg0: T, arg1: T) => T), xs: FSharpList<T>): T {
|
|
|
970
971
|
|
|
971
972
|
export function reduceBack<T>(f: ((arg0: T, arg1: T) => T), xs: FSharpList<T>): T {
|
|
972
973
|
if (FSharpList__get_IsEmpty<T>(xs)) {
|
|
973
|
-
throw new
|
|
974
|
+
throw new Exception(SR_inputWasEmpty);
|
|
974
975
|
}
|
|
975
976
|
else {
|
|
976
977
|
return foldBack<T, T>(f, tail<T>(xs), head<T>(xs));
|
|
@@ -995,7 +996,7 @@ export function exists2<T1, T2>(f_mut: ((arg0: T1, arg1: T2) => boolean), xs_mut
|
|
|
995
996
|
const f: ((arg0: T1, arg1: T2) => boolean) = f_mut, xs: FSharpList<T1> = xs_mut, ys: FSharpList<T2> = ys_mut;
|
|
996
997
|
const matchValue: boolean = FSharpList__get_IsEmpty<T1>(xs);
|
|
997
998
|
const matchValue_1: boolean = FSharpList__get_IsEmpty<T2>(ys);
|
|
998
|
-
let matchResult: int32;
|
|
999
|
+
let matchResult: int32 = undefined as any;
|
|
999
1000
|
if (matchValue) {
|
|
1000
1001
|
if (matchValue_1) {
|
|
1001
1002
|
matchResult = 0;
|
|
@@ -1024,7 +1025,7 @@ export function exists2<T1, T2>(f_mut: ((arg0: T1, arg1: T2) => boolean), xs_mut
|
|
|
1024
1025
|
continue exists2;
|
|
1025
1026
|
}
|
|
1026
1027
|
default:
|
|
1027
|
-
throw new
|
|
1028
|
+
throw new Exception((SR_differentLengths + "\\nParameter name: ") + "list2");
|
|
1028
1029
|
}
|
|
1029
1030
|
break;
|
|
1030
1031
|
}
|
|
@@ -1047,7 +1048,7 @@ export function zip3<$a, $b, $c>(xs: FSharpList<$a>, ys: FSharpList<$b>, zs: FSh
|
|
|
1047
1048
|
}
|
|
1048
1049
|
|
|
1049
1050
|
export function sortWith<T>(comparer: ((arg0: T, arg1: T) => int32), xs: FSharpList<T>): FSharpList<T> {
|
|
1050
|
-
const arr: T
|
|
1051
|
+
const arr: MutableArray<T> = toArray<T>(xs);
|
|
1051
1052
|
arr.sort(comparer);
|
|
1052
1053
|
return ofArray<T>(arr);
|
|
1053
1054
|
}
|
|
@@ -1115,7 +1116,7 @@ export function permute<T>(f: ((arg0: int32) => int32), xs: FSharpList<T>): FSha
|
|
|
1115
1116
|
}
|
|
1116
1117
|
|
|
1117
1118
|
export function chunkBySize<T>(chunkSize: int32, xs: FSharpList<T>): FSharpList<FSharpList<T>> {
|
|
1118
|
-
return ofArray<FSharpList<T>>(map_1<T
|
|
1119
|
+
return ofArray<FSharpList<T>>(map_1<MutableArray<T>, FSharpList<T>>(ofArray, chunkBySize_1<T>(chunkSize, toArray<T>(xs))));
|
|
1119
1120
|
}
|
|
1120
1121
|
|
|
1121
1122
|
export function allPairs<T1, T2>(xs: FSharpList<T1>, ys: FSharpList<T2>): FSharpList<[T1, T2]> {
|
|
@@ -1123,7 +1124,7 @@ export function allPairs<T1, T2>(xs: FSharpList<T1>, ys: FSharpList<T2>): FSharp
|
|
|
1123
1124
|
let node: FSharpList<[T1, T2]> = root;
|
|
1124
1125
|
iterate<T1>((x: T1): void => {
|
|
1125
1126
|
iterate<T2>((y: T2): void => {
|
|
1126
|
-
let xs_1: FSharpList<[T1, T2]
|
|
1127
|
+
let xs_1: FSharpList<[T1, T2]> = (undefined as any), t: FSharpList<[T1, T2]> = (undefined as any);
|
|
1127
1128
|
node = ((xs_1 = node, (t = (new FSharpList([x, y] as [T1, T2], undefined)), (xs_1.tail = t, t))));
|
|
1128
1129
|
}, ys);
|
|
1129
1130
|
}, xs);
|
|
@@ -1141,7 +1142,7 @@ export function skip<T>(count_mut: int32, xs_mut: FSharpList<T>): FSharpList<T>
|
|
|
1141
1142
|
return xs;
|
|
1142
1143
|
}
|
|
1143
1144
|
else if (FSharpList__get_IsEmpty<T>(xs)) {
|
|
1144
|
-
throw new
|
|
1145
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
|
|
1145
1146
|
}
|
|
1146
1147
|
else {
|
|
1147
1148
|
count_mut = (count - 1);
|
|
@@ -1173,18 +1174,18 @@ export function skipWhile<T>(predicate_mut: ((arg0: T) => boolean), xs_mut: FSha
|
|
|
1173
1174
|
|
|
1174
1175
|
export function take<T>(count: int32, xs: FSharpList<T>): FSharpList<T> {
|
|
1175
1176
|
if (count < 0) {
|
|
1176
|
-
throw new
|
|
1177
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "count");
|
|
1177
1178
|
}
|
|
1178
1179
|
const loop = (i_mut: int32, acc_mut: FSharpList<T>, xs_1_mut: FSharpList<T>): FSharpList<T> => {
|
|
1179
1180
|
loop:
|
|
1180
1181
|
while (true) {
|
|
1181
1182
|
const i: int32 = i_mut, acc: FSharpList<T> = acc_mut, xs_1: FSharpList<T> = xs_1_mut;
|
|
1182
|
-
let t: FSharpList<T
|
|
1183
|
+
let t: FSharpList<T> = undefined as any;
|
|
1183
1184
|
if (i <= 0) {
|
|
1184
1185
|
return acc;
|
|
1185
1186
|
}
|
|
1186
1187
|
else if (FSharpList__get_IsEmpty<T>(xs_1)) {
|
|
1187
|
-
throw new
|
|
1188
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "list");
|
|
1188
1189
|
}
|
|
1189
1190
|
else {
|
|
1190
1191
|
i_mut = (i - 1);
|
|
@@ -1207,7 +1208,7 @@ export function takeWhile<T>(predicate: ((arg0: T) => boolean), xs: FSharpList<T
|
|
|
1207
1208
|
loop:
|
|
1208
1209
|
while (true) {
|
|
1209
1210
|
const acc: FSharpList<T> = acc_mut, xs_1: FSharpList<T> = xs_1_mut;
|
|
1210
|
-
let t: FSharpList<T
|
|
1211
|
+
let t: FSharpList<T> = undefined as any;
|
|
1211
1212
|
if (FSharpList__get_IsEmpty<T>(xs_1)) {
|
|
1212
1213
|
return acc;
|
|
1213
1214
|
}
|
|
@@ -1234,7 +1235,7 @@ export function truncate<T>(count: int32, xs: FSharpList<T>): FSharpList<T> {
|
|
|
1234
1235
|
loop:
|
|
1235
1236
|
while (true) {
|
|
1236
1237
|
const i: int32 = i_mut, acc: FSharpList<T> = acc_mut, xs_1: FSharpList<T> = xs_1_mut;
|
|
1237
|
-
let t: FSharpList<T
|
|
1238
|
+
let t: FSharpList<T> = undefined as any;
|
|
1238
1239
|
if (i <= 0) {
|
|
1239
1240
|
return acc;
|
|
1240
1241
|
}
|
|
@@ -1275,23 +1276,23 @@ export function getSlice<T>(startIndex: Option<int32>, endIndex: Option<int32>,
|
|
|
1275
1276
|
|
|
1276
1277
|
export function splitAt<T>(index: int32, xs: FSharpList<T>): [FSharpList<T>, FSharpList<T>] {
|
|
1277
1278
|
if (index < 0) {
|
|
1278
|
-
throw new
|
|
1279
|
+
throw new Exception((SR_inputMustBeNonNegative + "\\nParameter name: ") + "index");
|
|
1279
1280
|
}
|
|
1280
1281
|
if (index > FSharpList__get_Length<T>(xs)) {
|
|
1281
|
-
throw new
|
|
1282
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
|
|
1282
1283
|
}
|
|
1283
1284
|
return [take<T>(index, xs), skip<T>(index, xs)] as [FSharpList<T>, FSharpList<T>];
|
|
1284
1285
|
}
|
|
1285
1286
|
|
|
1286
1287
|
export function exactlyOne<T>(xs: FSharpList<T>): T {
|
|
1287
1288
|
if (FSharpList__get_IsEmpty<T>(xs)) {
|
|
1288
|
-
throw new
|
|
1289
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "list");
|
|
1289
1290
|
}
|
|
1290
1291
|
else if (FSharpList__get_IsEmpty<T>(FSharpList__get_Tail<T>(xs))) {
|
|
1291
1292
|
return FSharpList__get_Head<T>(xs);
|
|
1292
1293
|
}
|
|
1293
1294
|
else {
|
|
1294
|
-
throw new
|
|
1295
|
+
throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "list");
|
|
1295
1296
|
}
|
|
1296
1297
|
}
|
|
1297
1298
|
|
|
@@ -1313,15 +1314,15 @@ export function pairwise<T>(xs: FSharpList<T>): FSharpList<[T, T]> {
|
|
|
1313
1314
|
}
|
|
1314
1315
|
|
|
1315
1316
|
export function windowed<T>(windowSize: int32, xs: FSharpList<T>): FSharpList<FSharpList<T>> {
|
|
1316
|
-
return ofArray<FSharpList<T>>(map_1<T
|
|
1317
|
+
return ofArray<FSharpList<T>>(map_1<MutableArray<T>, FSharpList<T>>(ofArray, windowed_1<T>(windowSize, toArray<T>(xs))));
|
|
1317
1318
|
}
|
|
1318
1319
|
|
|
1319
1320
|
export function splitInto<T>(chunks: int32, xs: FSharpList<T>): FSharpList<FSharpList<T>> {
|
|
1320
|
-
return ofArray<FSharpList<T>>(map_1<T
|
|
1321
|
+
return ofArray<FSharpList<T>>(map_1<MutableArray<T>, FSharpList<T>>(ofArray, splitInto_1<T>(chunks, toArray<T>(xs))));
|
|
1321
1322
|
}
|
|
1322
1323
|
|
|
1323
1324
|
export function transpose<T>(lists: Iterable<FSharpList<T>>): FSharpList<FSharpList<T>> {
|
|
1324
|
-
return ofArray<FSharpList<T>>(map_1<T
|
|
1325
|
+
return ofArray<FSharpList<T>>(map_1<MutableArray<T>, FSharpList<T>>(ofArray, transpose_1<T>(map_1<FSharpList<T>, MutableArray<T>>(toArray, Array.from(lists)))));
|
|
1325
1326
|
}
|
|
1326
1327
|
|
|
1327
1328
|
export function insertAt<T>(index: int32, y: T, xs: FSharpList<T>): FSharpList<T> {
|
|
@@ -1338,7 +1339,7 @@ export function insertAt<T>(index: int32, y: T, xs: FSharpList<T>): FSharpList<T
|
|
|
1338
1339
|
}
|
|
1339
1340
|
}, FSharpList_get_Empty<T>(), xs);
|
|
1340
1341
|
return reverse<T>(isDone ? result : (((i + 1) === index) ? FSharpList_Cons_305B8EAC<T>(y, result) : (() => {
|
|
1341
|
-
throw new
|
|
1342
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1342
1343
|
})()));
|
|
1343
1344
|
}
|
|
1344
1345
|
|
|
@@ -1357,7 +1358,7 @@ export function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: FSharpList<T>
|
|
|
1357
1358
|
}
|
|
1358
1359
|
}, FSharpList_get_Empty<T>(), xs);
|
|
1359
1360
|
return reverse<T>(isDone ? result : (((i + 1) === index) ? append<T>(ys_1, result) : (() => {
|
|
1360
|
-
throw new
|
|
1361
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1361
1362
|
})()));
|
|
1362
1363
|
}
|
|
1363
1364
|
|
|
@@ -1375,7 +1376,7 @@ export function removeAt<T>(index: int32, xs: FSharpList<T>): FSharpList<T> {
|
|
|
1375
1376
|
}
|
|
1376
1377
|
}, xs);
|
|
1377
1378
|
if (!isDone) {
|
|
1378
|
-
throw new
|
|
1379
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1379
1380
|
}
|
|
1380
1381
|
return ys;
|
|
1381
1382
|
}
|
|
@@ -1404,7 +1405,7 @@ export function removeManyAt<T>(index: int32, count: int32, xs: FSharpList<T>):
|
|
|
1404
1405
|
}, xs);
|
|
1405
1406
|
const status_1: int32 = (((status === 0) && ((i + 1) === (index + count))) ? 1 : status) | 0;
|
|
1406
1407
|
if (status_1 < 1) {
|
|
1407
|
-
throw new
|
|
1408
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + ((status_1 < 0) ? "index" : "count"));
|
|
1408
1409
|
}
|
|
1409
1410
|
return ys;
|
|
1410
1411
|
}
|
|
@@ -1421,7 +1422,7 @@ export function updateAt<T>(index: int32, y: T, xs: FSharpList<T>): FSharpList<T
|
|
|
1421
1422
|
}
|
|
1422
1423
|
}, xs);
|
|
1423
1424
|
if (!isDone) {
|
|
1424
|
-
throw new
|
|
1425
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1425
1426
|
}
|
|
1426
1427
|
return ys;
|
|
1427
1428
|
}
|
package/Long.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { getPrefix, isValid } from "./Int32.
|
|
2
|
-
import { fromString } from "./BigInt.
|
|
3
|
-
import { FSharpRef } from "./Types.
|
|
1
|
+
import { getPrefix, isValid } from "./Int32.ts";
|
|
2
|
+
import { fromString } from "./BigInt.ts";
|
|
3
|
+
import { FSharpRef } from "./Types.ts";
|
|
4
|
+
import { Exception } from "./Util.ts";
|
|
4
5
|
|
|
5
6
|
function getMaxValue(unsigned: boolean, radix: number, isNegative: boolean) {
|
|
6
7
|
switch (radix) {
|
|
@@ -17,7 +18,7 @@ function getMaxValue(unsigned: boolean, radix: number, isNegative: boolean) {
|
|
|
17
18
|
case 16: return unsigned ?
|
|
18
19
|
"FFFFFFFFFFFFFFFF" :
|
|
19
20
|
(isNegative ? "8000000000000000" : "7FFFFFFFFFFFFFFF");
|
|
20
|
-
default: throw new
|
|
21
|
+
default: throw new Exception("Invalid radix.");
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -36,7 +37,7 @@ export function parse(str: string, style: number, unsigned: boolean, _bitsize: n
|
|
|
36
37
|
return fromString(str);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
throw new
|
|
40
|
+
throw new Exception(`The input string ${str} was not in a correct format.`);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
export function tryParse(str: string, style: number, unsigned: boolean, bitsize: number, defValue: FSharpRef<bigint>) {
|
package/MailboxProcessor.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defaultCancellationToken } from "./Async.
|
|
2
|
-
import { fromContinuations } from "./Async.
|
|
3
|
-
import { startImmediate } from "./Async.
|
|
4
|
-
import { Async } from "./AsyncBuilder.
|
|
5
|
-
import { Continuation, Continuations } from "./AsyncBuilder.
|
|
6
|
-
import { CancellationToken } from "./AsyncBuilder.
|
|
1
|
+
import { defaultCancellationToken } from "./Async.ts";
|
|
2
|
+
import { fromContinuations } from "./Async.ts";
|
|
3
|
+
import { startImmediate } from "./Async.ts";
|
|
4
|
+
import { Async } from "./AsyncBuilder.ts";
|
|
5
|
+
import { Continuation, Continuations } from "./AsyncBuilder.ts";
|
|
6
|
+
import { CancellationToken } from "./AsyncBuilder.ts";
|
|
7
|
+
import { Exception } from "./Util.ts";
|
|
7
8
|
|
|
8
9
|
class QueueCell<Msg> {
|
|
9
10
|
public value: Msg;
|
|
@@ -79,7 +80,7 @@ export function startInstance<Msg>($this: MailboxProcessor<Msg>) {
|
|
|
79
80
|
export function receive<Msg>($this: MailboxProcessor<Msg>) {
|
|
80
81
|
return fromContinuations((conts: Continuations<Msg>) => {
|
|
81
82
|
if ($this.continuation) {
|
|
82
|
-
throw new
|
|
83
|
+
throw new Exception("Receive can only be called once!");
|
|
83
84
|
}
|
|
84
85
|
$this.continuation = conts[0];
|
|
85
86
|
__processEvents($this);
|