forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseq.fsi
More file actions
1063 lines (975 loc) · 58.8 KB
/
Copy pathseq.fsi
File metadata and controls
1063 lines (975 loc) · 58.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.FSharp.Collections
open System
open System.Collections
open System.Collections.Generic
open Microsoft.FSharp.Core
open Microsoft.FSharp.Collections
/// <summary>Basic operations on IEnumerables.</summary>
[<RequireQualifiedAccess>]
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Seq =
/// <summary>Wraps the two given enumerations as a single concatenated
/// enumeration.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed
/// concurrently.</remarks>
///
/// <param name="source1">The first sequence.</param>
/// <param name="source2">The second sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the two provided sequences is
/// null.</exception>
[<CompiledName("Append")>]
val append: source1:seq<'T> -> source2:seq<'T> -> seq<'T>
/// <summary>Returns the average of the elements in the sequence.</summary>
///
/// <remarks>The elements are averaged using the <c>+</c> operator, <c>DivideByInt</c> method and <c>Zero</c> property
/// associated with the element type.</remarks>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The average.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence has zero elements.</exception>
[<CompiledName("Average")>]
val inline average : source:seq<(^T)> -> ^T
when ^T : (static member ( + ) : ^T * ^T -> ^T)
and ^T : (static member DivideByInt : ^T * int -> ^T)
and ^T : (static member Zero : ^T)
/// <summary>Returns the average of the results generated by applying the function to each element
/// of the sequence.</summary>
///
/// <remarks>The elements are averaged using the <c>+</c> operator, <c>DivideByInt</c> method and <c>Zero</c> property
/// associated with the generated type.</remarks>
///
/// <param name="projection">A function applied to transform each element of the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The average.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence has zero elements.</exception>
[<CompiledName("AverageBy")>]
val inline averageBy : projection:('T -> ^U) -> source:seq<'T> -> ^U
when ^U : (static member ( + ) : ^U * ^U -> ^U)
and ^U : (static member DivideByInt : ^U * int -> ^U)
and ^U : (static member Zero : ^U)
/// <summary>Returns a sequence that corresponds to a cached version of the input sequence.
/// This result sequence will have the same elements as the input sequence. The result
/// can be enumerated multiple times. The input sequence will be enumerated at most
/// once and only as far as is necessary. Caching a sequence is typically useful when repeatedly
/// evaluating items in the original sequence is computationally expensive or if
/// iterating the sequence causes side-effects that the user does not want to be
/// repeated multiple times.
///
/// Enumeration of the result sequence is thread safe in the sense that multiple independent IEnumerator
/// values may be used simultaneously from different threads (accesses to
/// the internal lookaside table are thread safe). Each individual IEnumerator
/// is not typically thread safe and should not be accessed concurrently.</summary>
///
/// <remarks>Once enumeration of the input sequence has started,
/// it's enumerator will be kept live by this object until the enumeration has completed.
/// At that point, the enumerator will be disposed.
///
/// The enumerator may be disposed and underlying cache storage released by
/// converting the returned sequence object to type IDisposable, and calling the Dispose method
/// on this object. The sequence object may then be re-enumerated and a fresh enumerator will
/// be used.</remarks>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Cache")>]
val cache: source:seq<'T> -> seq<'T>
/// <summary>Wraps a loosely-typed System.Collections sequence as a typed sequence.</summary>
///
/// <remarks>The use of this function usually requires a type annotation.
/// An incorrect type annotation may result in runtime type
/// errors.
/// Individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Cast")>]
val cast: source:IEnumerable -> seq<'T>
/// <summary>Applies the given function to each element of the list. Return
/// the list comprised of the results "x" for each element where
/// the function returns Some(x).</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not
/// be accessed concurrently.</remarks>
///
/// <param name="chooser">A function to transform items of type T into options of type U.</param>
/// <param name="source">The input sequence of type T.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Choose")>]
val choose: chooser:('T -> 'U option) -> source:seq<'T> -> seq<'U>
/// <summary>Applies the given function to each element of the sequence and concatenates all the
/// results.</summary>
///
/// <remarks>Remember sequence is lazy, effects are delayed until it is enumerated.</remarks>
///
/// <param name="mapping">A function to transform elements of the input sequence into the sequences
/// that will then be concatenated.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Collect")>]
val collect: mapping:('T -> 'Collection) -> source:seq<'T> -> seq<'U> when 'Collection :> seq<'U>
/// <summary>Compares two sequences using the given comparison function, element by element.
/// Returns the first non-zero result from the comparison function. If the end of a sequence
/// is reached it returns a -1 if the first sequence is shorter and a 1 if the second sequence
/// is shorter.</summary>
///
/// <param name="comparer">A function that takes an element from each sequence and returns an int.
/// If it evaluates to a non-zero value iteration is stopped and that value is returned.</param>
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <returns>The first non-zero value from the comparison function.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the input sequences
/// is null.</exception>
[<CompiledName("CompareWith")>]
val compareWith: comparer:('T -> 'T -> int) -> source1:seq<'T> -> source2:seq<'T> -> int
/// <summary>Combines the given enumeration-of-enumerations as a single concatenated
/// enumeration.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
///
/// <param name="sources">The input enumeration-of-enumerations.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Concat")>]
val concat: sources:seq<'Collection> -> seq<'T> when 'Collection :> seq<'T>
/// <summary>Applies a key-generating function to each element of a sequence and return a sequence yielding unique
/// keys and their number of occurrences in the original sequence.</summary>
///
/// <remarks>Note that this function returns a sequence that digests the whole initial sequence as soon as
/// that sequence is iterated. As a result this function should not be used with
/// large or infinite sequences. The function makes no assumption on the ordering of the original
/// sequence.</remarks>
///
/// <param name="projection">A function transforming each item of input sequence into a key to be
/// compared against the others.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("CountBy")>]
val countBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * int> when 'Key : equality
/// <summary>Returns a sequence that is built from the given delayed specification of a
/// sequence.</summary>
///
/// <remarks>The input function is evaluated each time an IEnumerator for the sequence
/// is requested.</remarks>
///
/// <param name="generator">The generating function for the sequence.</param>
[<CompiledName("Delay")>]
val delay : generator:(unit -> seq<'T>) -> seq<'T>
/// <summary>Returns a sequence that contains no duplicate entries according to generic hash and
/// equality comparisons on the entries.
/// If an element occurs multiple times in the sequence then the later occurrences are discarded.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Distinct")>]
val distinct: source:seq<'T> -> seq<'T> when 'T : equality
/// <summary>Returns a sequence that contains no duplicate entries according to the
/// generic hash and equality comparisons on the keys returned by the given key-generating function.
/// If an element occurs multiple times in the sequence then the later occurrences are discarded.</summary>
///
/// <param name="projection">A function transforming the sequence items into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("DistinctBy")>]
val distinctBy: projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : equality
/// <summary>Creates an empty sequence.</summary>
///
/// <returns>An empty sequence.</returns>
[<GeneralizableValueAttribute>]
[<CompiledName("Empty")>]
val empty<'T> : seq<'T>
/// <summary>Tests if any element of the sequence satisfies the given predicate.</summary>
///
/// <remarks>The predicate is applied to the elements of the input sequence. If any application
/// returns true then the overall result is true and no further elements are tested.
/// Otherwise, false is returned.</remarks>
///
/// <param name="predicate">A function to test each item of the input sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>True if any result from the predicate is true; false otherwise.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Exists")>]
val exists: predicate:('T -> bool) -> source:seq<'T> -> bool
/// <summary>Tests if any pair of corresponding elements of the input sequences satisfies the given predicate.</summary>
///
/// <remarks>The predicate is applied to matching elements in the two sequences up to the lesser of the
/// two lengths of the collections. If any application returns true then the overall result is
/// true and no further elements are tested. Otherwise, false is returned. If one sequence is shorter than
/// the other then the remaining elements of the longer sequence are ignored.</remarks>
///
/// <param name="predicate">A function to test each pair of items from the input sequences.</param>
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <returns>True if any result from the predicate is true; false otherwise.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the two input sequences is null.</exception>
[<CompiledName("Exists2")>]
val exists2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool
/// <summary>Returns a new collection containing only the elements of the collection
/// for which the given predicate returns "true". This is a synonym for Seq.where.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.
///
/// Remember sequence is lazy, effects are delayed until it is enumerated.</remarks>
///
/// <param name="predicate">A function to test whether each item in the input sequence should be included in the output.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Filter")>]
val filter: predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>Returns a new collection containing only the elements of the collection
/// for which the given predicate returns "true".</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.
///
/// Remember sequence is lazy, effects are delayed until it is enumerated.
///
/// A synonym for Seq.filter.</remarks>
///
/// <param name="predicate">A function to test whether each item in the input sequence should be included in the output.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Where")>]
val where: predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>Returns the first element for which the given function returns <c>true</c>.</summary>
///
/// <param name="predicate">A function to test whether an item in the sequence should be returned.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The first element for which the predicate returns <c>true</c>.</returns>
///
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null</exception>
[<CompiledName("Find")>]
val find: predicate:('T -> bool) -> source:seq<'T> -> 'T
/// <summary>Returns the index of the first element for which the given function returns <c>true</c>.</summary>
///
/// <param name="predicate">A function to test whether the index of a particular element should be returned.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The index of the first element for which the predicate returns <c>true</c>.</returns>
///
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown if no element returns true when
/// evaluated by the predicate</exception>
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null</exception>
[<CompiledName("FindIndex")>]
val findIndex: predicate:('T -> bool) -> source:seq<'T> -> int
/// <summary>Applies a function to each element of the collection, threading an accumulator argument
/// through the computation. If the input function is <c>f</c> and the elements are <c>i0...iN</c>
/// then computes <c>f (... (f s i0)...) iN</c></summary>
///
/// <param name="folder">A function that updates the state with each element from the sequence.</param>
/// <param name="state">The initial state.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The state object after the folding function is applied to each element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Fold")>]
val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> 'State
/// <summary>Tests if all elements of the sequence satisfy the given predicate.</summary>
///
/// <remarks>The predicate is applied to the elements of the input sequence. If any application
/// returns false then the overall result is false and no further elements are tested.
/// Otherwise, true is returned.</remarks>
///
/// <param name="predicate">A function to test an element of the input sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>True if every element of the sequence satisfies the predicate; false otherwise.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("ForAll")>]
val forall: predicate:('T -> bool) -> source:seq<'T> -> bool
/// <summary>Tests the all pairs of elements drawn from the two sequences satisfy the
/// given predicate. If one sequence is shorter than
/// the other then the remaining elements of the longer sequence are ignored.</summary>
///
/// <param name="predicate">A function to test pairs of elements from the input sequences.</param>
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <returns>True if all pairs satisfy the predicate; false otherwise.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the input sequences is null.</exception>
[<CompiledName("ForAll2")>]
val forall2: predicate:('T1 -> 'T2 -> bool) -> source1:seq<'T1> -> source2:seq<'T2> -> bool
/// <summary>Applies a key-generating function to each element of a sequence and yields a sequence of
/// unique keys. Each unique key contains a sequence of all elements that match
/// to this key.</summary>
///
/// <remarks>This function returns a sequence that digests the whole initial sequence as soon as
/// that sequence is iterated. As a result this function should not be used with
/// large or infinite sequences. The function makes no assumption on the ordering of the original
/// sequence.</remarks>
///
/// <param name="projection">A function that transforms an element of the sequence into a comparable key.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
[<CompiledName("GroupBy")>]
val groupBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'Key * seq<'T>> when 'Key : equality
/// <summary>Returns the first element of the sequence.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The first element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input does not have any elements.</exception>
[<CompiledName("Head")>]
val head: source:seq<'T> -> 'T
/// <summary>Returns the last element of the sequence.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The last element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input does not have any elements.</exception>
[<CompiledName("Last")>]
val last: source:seq<'T> -> 'T
/// <summary>Returns the only element of the sequence.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The last element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input does not have precisely one element.</exception>
[<CompiledName("ExactlyOne")>]
val exactlyOne: source:seq<'T> -> 'T
/// <summary>Returns true if the sequence contains no elements, false otherwise.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>True if the sequence is empty; false otherwise.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("IsEmpty")>]
val isEmpty: source:seq<'T> -> bool
/// <summary>Generates a new sequence which, when iterated, will return successive
/// elements by calling the given function, up to the given count. Each element is saved after its
/// initialization. The function is passed the index of the item being
/// generated.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
///
/// <param name="count">The maximum number of items to generate for the sequence.</param>
/// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentException">Thrown when count is negative.</exception>
[<CompiledName("Initialize")>]
val init: count:int -> initializer:(int -> 'T) -> seq<'T>
/// <summary>Generates a new sequence which, when iterated, will return successive
/// elements by calling the given function. The results of calling the function
/// will not be saved, that is the function will be reapplied as necessary to
/// regenerate the elements. The function is passed the index of the item being
/// generated.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.
/// Iteration can continue up to <c>Int32.MaxValue</c>.</remarks>
///
/// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
///
/// <returns>The result sequence.</returns>
[<CompiledName("InitializeInfinite")>]
val initInfinite: initializer:(int -> 'T) -> seq<'T>
/// <summary>Applies the given function to each element of the collection.</summary>
///
/// <param name="action">A function to apply to each element of the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Iterate")>]
val iter: action:('T -> unit) -> source:seq<'T> -> unit
/// <summary>Applies the given function to each element of the collection. The integer passed to the
/// function indicates the index of element.</summary>
///
/// <param name="action">A function to apply to each element of the sequence that can also access the current index.</param>
/// <param name="source">The input sequence.</param>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("IterateIndexed")>]
val iteri: action:(int -> 'T -> unit) -> source:seq<'T> -> unit
/// <summary>Applies the given function to two collections simultaneously. If one sequence is shorter than
/// the other then the remaining elements of the longer sequence are ignored.</summary>
///
/// <param name="action">A function to apply to each pair of elements from the input sequences.</param>
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the input sequences is null.</exception>
[<CompiledName("Iterate2")>]
val iter2: action:('T1 -> 'T2 -> unit) -> source1:seq<'T1> -> source2:seq<'T2> -> unit
/// <summary>Returns the length of the sequence</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The length of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Length")>]
val length: source:seq<'T> -> int
/// <summary>Builds a new collection whose elements are the results of applying the given function
/// to each of the elements of the collection. The given function will be applied
/// as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the
/// object.</summary>
///
/// <remarks>The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
///
/// <param name="mapping">A function to transform items from the input sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Map")>]
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>
/// <summary>Builds a new collection whose elements are the results of applying the given function
/// to the corresponding pairs of elements from the two sequences. If one input sequence is shorter than
/// the other then the remaining elements of the longer sequence are ignored.</summary>
///
/// <param name="mapping">A function to transform pairs of items from the input sequences.</param>
/// <param name="source">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the input sequences is null.</exception>
[<CompiledName("Map2")>]
val map2: mapping:('T1 -> 'T2 -> 'U) -> source1:seq<'T1> -> source2:seq<'T2> -> seq<'U>
/// <summary>Builds a new collection whose elements are the results of applying the given function
/// to each of the elements of the collection. The integer index passed to the
/// function indicates the index (from 0) of element being transformed.</summary>
///
/// <param name="mapping">A function to transform items from the input sequence that also supplies the current index.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("MapIndexed")>]
val mapi: mapping:(int -> 'T -> 'U) -> source:seq<'T> -> seq<'U>
/// <summary>Returns the greatest of all elements of the sequence, compared via Operators.max</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
///
/// <returns>The largest element of the sequence.</returns>
[<CompiledName("Max")>]
val inline max : source:seq<'T> -> 'T when 'T : comparison
/// <summary>Returns the greatest of all elements of the sequence, compared via Operators.max on the function result.</summary>
///
/// <param name="projection">A function to transform items from the input sequence into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The largest element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("MaxBy")>]
val inline maxBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison
(*
/// <summary>Returns the greatest function result from the elements of the sequence, compared via Operators.max.</summary>
///
/// <param name="projection">A function to transform items from the input sequence into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The largest element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("MaxValueBy")>]
val inline maxValBy : projection:('T -> 'U) -> source:seq<'T> -> 'U when 'U : comparison
*)
/// <summary>Returns the lowest of all elements of the sequence, compared via <c>Operators.min</c>.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The smallest element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("Min")>]
val inline min : source:seq<'T> -> 'T when 'T : comparison
/// <summary>Returns the lowest of all elements of the sequence, compared via Operators.min on the function result.</summary>
///
/// <param name="projection">A function to transform items from the input sequence into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The smallest element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("MinBy")>]
val inline minBy : projection:('T -> 'U) -> source:seq<'T> -> 'T when 'U : comparison
(*
/// <summary>Returns the lowest function result from the elements of the sequence, compared via Operators.max.</summary>
///
/// <param name="projection">A function to transform items from the input sequence into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The smallest element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("MinValueBy")>]
val inline minValBy : projection:('T -> 'U) -> source:seq<'T> -> 'U when 'U : comparison
*)
/// <summary>Computes the nth element in the collection.</summary>
///
/// <param name="index">The index of element to retrieve.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The nth element of the sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Get")>]
val nth: index:int -> source:seq<'T> -> 'T
[<CompiledName("OfArray")>]
/// <summary>Views the given array as a sequence.</summary>
///
/// <param name="source">The input array.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
val ofArray: source:'T[] -> seq<'T>
[<CompiledName("OfList")>]
/// <summary>Views the given list as a sequence.</summary>
///
/// <param name="source">The input list.</param>
///
/// <returns>The result sequence.</returns>
val ofList: source:'T list -> seq<'T>
/// <summary>Returns a sequence of each element in the input sequence and its predecessor, with the
/// exception of the first element which is only returned as the predecessor of the second element.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Pairwise")>]
val pairwise: source:seq<'T> -> seq<'T * 'T>
/// <summary>Applies the given function to successive elements, returning the first
/// <c>x</c> where the function returns "Some(x)".</summary>
///
/// <param name="chooser">A function to transform each item of the input sequence into an option of the output type.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The selected element.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.Collections.Generic.KeyNotFoundException">Thrown when every item of the sequence
/// evaluates to <c>None</c> when the given function is applied.</exception>
[<CompiledName("Pick")>]
val pick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U
/// <summary>Builds a new sequence object that delegates to the given sequence object. This ensures
/// the original sequence cannot be rediscovered and mutated by a type cast. For example,
/// if given an array the returned sequence will return the elements of the array, but
/// you cannot cast the returned sequence object to an array.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("ReadOnly")>]
val readonly : source:seq<'T> -> seq<'T>
/// <summary>Applies a function to each element of the sequence, threading an accumulator argument
/// through the computation. Begin by applying the function to the first two elements.
/// Then feed this result into the function along with the third element and so on.
/// Return the final result.</summary>
///
/// <param name="reduction">A function that takes in the current accumulated result and the next
/// element of the sequence to produce the next accumulated result.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The final result of the reduction function.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("Reduce")>]
val reduce: reduction:('T -> 'T -> 'T) -> source:seq<'T> -> 'T
/// <summary>Like fold, but computes on-demand and returns the sequence of intermediary and final results.</summary>
///
/// <param name="folder">A function that updates the state with each element from the sequence.</param>
/// <param name="state">The initial state.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The resulting sequence of computed states.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Scan")>]
val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> source:seq<'T> -> seq<'State>
/// <summary>Returns a sequence that yields one item only.</summary>
///
/// <param name="value">The input item.</param>
///
/// <returns>The result sequence of one item.</returns>
[<CompiledName("Singleton")>]
val singleton: value:'T -> seq<'T>
/// <summary>Returns a sequence that skips N elements of the underlying sequence and then yields the
/// remaining elements of the sequence.</summary>
///
/// <param name="count">The number of items to skip.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.InvalidOperationException">Thrown when count exceeds the number of elements
/// in the sequence.</exception>
[<CompiledName("Skip")>]
val skip: count:int -> source:seq<'T> -> seq<'T>
/// <summary>Returns a sequence that, when iterated, skips elements of the underlying sequence while the
/// given predicate returns <c>true</c>, and then yields the remaining elements of the sequence.</summary>
///
/// <param name="predicate">A function that evaluates an element of the sequence to a boolean value.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("SkipWhile")>]
val skipWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>Yields a sequence ordered by keys.</summary>
///
/// <remarks>This function returns a sequence that digests the whole initial sequence as soon as
/// that sequence is iterated. As a result this function should not be used with
/// large or infinite sequences. The function makes no assumption on the ordering of the original
/// sequence.
///
/// This is a stable sort, that is the original order of equal elements is preserved.</remarks>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Sort")>]
val sort : source:seq<'T> -> seq<'T> when 'T : comparison
/// <summary>Applies a key-generating function to each element of a sequence and yield a sequence ordered
/// by keys. The keys are compared using generic comparison as implemented by <c>Operators.compare</c>.</summary>
///
/// <remarks>This function returns a sequence that digests the whole initial sequence as soon as
/// that sequence is iterated. As a result this function should not be used with
/// large or infinite sequences. The function makes no assumption on the ordering of the original
/// sequence.
///
/// This is a stable sort, that is the original order of equal elements is preserved.</remarks>
///
/// <param name="projection">A function to transform items of the input sequence into comparable keys.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("SortBy")>]
val sortBy : projection:('T -> 'Key) -> source:seq<'T> -> seq<'T> when 'Key : comparison
/// <summary>Returns the sum of the elements in the sequence.</summary>
///
/// <remarks>The elements are summed using the <c>+</c> operator and <c>Zero</c> property associated with the generated type.</remarks>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The computed sum.</returns>
[<CompiledName("Sum")>]
val inline sum : source:seq<(^T)> -> ^T
when ^T : (static member ( + ) : ^T * ^T -> ^T)
and ^T : (static member Zero : ^T)
/// <summary>Returns the sum of the results generated by applying the function to each element of the sequence.</summary>
/// <remarks>The generated elements are summed using the <c>+</c> operator and <c>Zero</c> property associated with the generated type.</remarks>
///
/// <param name="projection">A function to transform items from the input sequence into the type that will be summed.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The computed sum.</returns>
[<CompiledName("SumBy")>]
val inline sumBy : projection:('T -> ^U) -> source:seq<'T> -> ^U
when ^U : (static member ( + ) : ^U * ^U -> ^U)
and ^U : (static member Zero : ^U)
/// <summary>Returns the first N elements of the sequence.</summary>
/// <remarks>Throws <c>InvalidOperationException</c>
/// if the count exceeds the number of elements in the sequence. <c>Seq.truncate</c>
/// returns as many items as the sequence contains instead of throwing an exception.</remarks>
///
/// <param name="count">The number of items to take.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
/// <exception cref="System.InvalidOperationException">Thrown when count exceeds the number of elements
/// in the sequence.</exception>
[<CompiledName("Take")>]
val take: count:int -> source:seq<'T> -> seq<'T>
/// <summary>Returns a sequence that, when iterated, yields elements of the underlying sequence while the
/// given predicate returns <c>true</c>, and then returns no further elements.</summary>
///
/// <param name="predicate">A function that evaluates to false when no more items should be returned.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TakeWhile")>]
val takeWhile: predicate:('T -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>Builds an array from the given collection.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result array.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("ToArray")>]
val toArray: source:seq<'T> -> 'T[]
/// <summary>Builds a list from the given collection.</summary>
///
/// <param name="source">The input sequence.</param>
///
/// <returns>The result list.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("ToList")>]
val toList: source:seq<'T> -> 'T list
/// <summary>Returns the first element for which the given function returns <c>true</c>.
/// Return <c>None</c> if no such element exists.</summary>
///
/// <param name="predicate">A function that evaluates to a Boolean when given an item in the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The found element or <c>None</c>.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TryFind")>]
val tryFind: predicate:('T -> bool) -> source:seq<'T> -> 'T option
/// <summary>Returns the index of the first element in the sequence
/// that satisfies the given predicate. Return <c>None</c> if no such element exists.</summary>
///
/// <param name="predicate">A function that evaluates to a Boolean when given an item in the sequence.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The found index or <c>None</c>.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TryFindIndex")>]
val tryFindIndex : predicate:('T -> bool) -> source:seq<'T> -> int option
/// <summary>Applies the given function to successive elements, returning the first
/// result where the function returns "Some(x)".</summary>
///
/// <param name="chooser">A function that transforms items from the input sequence into options.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The chosen element or <c>None</c>.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("TryPick")>]
val tryPick: chooser:('T -> 'U option) -> source:seq<'T> -> 'U option
/// <summary>Returns a sequence that when enumerated returns at most N elements.</summary>
///
/// <param name="count">The maximum number of items to enumerate.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
[<CompiledName("Truncate")>]
val truncate: count:int -> source:seq<'T> -> seq<'T>
/// <summary>Returns a sequence that contains the elements generated by the given computation.
/// The given initial <c>state</c> argument is passed to the element generator.
/// For each IEnumerator elements in the stream are generated on-demand by applying the element
/// generator, until a None value is returned by the element generator. Each call to the element
/// generator returns a new residual <c>state</c>.</summary>
///
/// <remarks>The stream will be recomputed each time an IEnumerator is requested and iterated for the Seq.
///
/// The returned sequence may be passed between threads safely. However,
/// individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
///
/// <param name="generator">A function that takes in the current state and returns an option tuple of the next
/// element of the sequence and the next state value.</param>
/// <param name="state">The initial state value.</param>
///
/// <returns>The result sequence.</returns>
[<CompiledName("Unfold")>]
val unfold : generator:('State -> ('T * 'State) option) -> state:'State -> seq<'T>
/// <summary>Returns a sequence that yields sliding windows of containing elements drawn from the input
/// sequence. Each window is returned as a fresh array.</summary>
///
/// <param name="windowSize">The number of elements in each window.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when the input sequence is null.</exception>
/// <exception cref="System.ArgumentException">Thrown when the input sequence is empty.</exception>
[<CompiledName("Windowed")>]
val windowed: windowSize:int -> source:seq<'T> -> seq<'T[]>
/// <summary>Combines the two sequences into a list of pairs. The two sequences need not have equal lengths:
/// when one sequence is exhausted any remaining elements in the other
/// sequence are ignored.</summary>
///
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when either of the input sequences is null.</exception>
[<CompiledName("Zip")>]
val zip: source1:seq<'T1> -> source2:seq<'T2> -> seq<'T1 * 'T2>
/// <summary>Combines the three sequences into a list of triples. The sequences need not have equal lengths:
/// when one sequence is exhausted any remaining elements in the other
/// sequences are ignored.</summary>
///
/// <param name="source1">The first input sequence.</param>
/// <param name="source2">The second input sequence.</param>
/// <param name="source3">The third input sequence.</param>
///
/// <returns>The result sequence.</returns>
///
/// <exception cref="System.ArgumentNullException">Thrown when any of the input sequences is null.</exception>
[<CompiledName("Zip3")>]
val zip3: source1:seq<'T1> -> source2:seq<'T2> -> source3:seq<'T3> -> seq<'T1 * 'T2 * 'T3>
namespace Microsoft.FSharp.Core.CompilerServices
open System
open System.Collections
open System.Collections.Generic
open Microsoft.FSharp.Core
open Microsoft.FSharp.Collections
[<RequireQualifiedAccess>]
/// <summary>A group of functions used as part of the compiled representation of F# sequence expressions.</summary>
module RuntimeHelpers =
[<Struct; NoComparison; NoEquality>]
type internal StructBox<'T when 'T : equality> =
new : value:'T -> StructBox<'T>
member Value : 'T
static member Comparer : IEqualityComparer<StructBox<'T>>
/// <summary>The F# compiler emits calls to this function to
/// implement the <c>while</c> operator for F# sequence expressions.</summary>
///
/// <param name="guard">A function that indicates whether iteration should continue.</param>
/// <param name="source">The input sequence.</param>
///
/// <returns>The result sequence.</returns>
val EnumerateWhile : guard:(unit -> bool) -> source:seq<'T> -> seq<'T>
/// <summary>The F# compiler emits calls to this function to
/// implement the <c>try/finally</c> operator for F# sequence expressions.</summary>