@@ -15,10 +15,17 @@ module TaskSeq =
1515
1616 /// <summary>
1717 /// Returns the length of the sequence. This operation requires the whole sequence to be evaluated and
18- /// should not be used on potentially infinite sequences.
18+ /// should not be used on potentially infinite sequences, see <see cref="lengthOrMax" /> for an alternative .
1919 /// </summary>
2020 val length : source : taskSeq < 'T > -> Task < int >
2121
22+ /// <summary>
23+ /// Returns the length of the sequence, or <paramref name="max" />, whichever comes first. This operation requires the task sequence
24+ /// to be evaluated in full, or until <paramref name="max" /> items have been processed. Use this method instead of
25+ /// <see cref="TaskSeq.length" /> if you want to prevent too many items to be evaluated, or if the sequence is potentially infinite.
26+ /// </summary>
27+ val lengthOrMax : max : int -> source : taskSeq < 'T > -> Task < int >
28+
2229 /// <summary>
2330 /// Returns the length of the sequence of all items for which the <paramref name="predicate" /> returns true.
2431 /// This operation requires the whole sequence to be evaluated and should not be used on potentially infinite sequences.
@@ -32,6 +39,74 @@ module TaskSeq =
3239 /// </summary>
3340 val lengthByAsync : predicate : ( 'T -> #Task < bool >) -> source : taskSeq < 'T > -> Task < int >
3441
42+ /// <summary>
43+ /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function
44+ /// with the current index, up to the given count. Each element is saved after its initialization for successive access to
45+ /// <see cref="IAsyncEnumerator.Current" />, which will not re-evaluate the <paramref name="initializer" />. However,
46+ /// re-iterating the returned task sequence will re-evaluate the initialization function. The returned sequence may
47+ /// be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should
48+ /// not be accessed concurrently.
49+ /// </summary>
50+ ///
51+ /// <param name="count">The maximum number of items to generate for the sequence.</param>
52+ /// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
53+ /// <returns>The resulting task sequence.</returns>
54+ /// <exception cref="T:System.ArgumentException">Thrown when count is negative.</exception>
55+ val init : count : int -> initializer : ( int -> 'T ) -> taskSeq < 'T >
56+
57+ /// <summary>
58+ /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function
59+ /// with the current index, up to the given count. Each element is saved after its initialization for successive access to
60+ /// <see cref="IAsyncEnumerator.Current" />, which will not re-evaluate the <paramref name="initializer" />. However,
61+ /// re-iterating the returned task sequence will re-evaluate the initialization function. The returned sequence may
62+ /// be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should
63+ /// not be accessed concurrently.
64+ /// </summary>
65+ ///
66+ /// <param name="count">The maximum number of items to generate for the sequence.</param>
67+ /// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
68+ /// <returns>The resulting task sequence.</returns>
69+ /// <exception cref="T:System.ArgumentException">Thrown when count is negative.</exception>
70+ val initAsync : count : int -> initializer : ( int -> #Task < 'T >) -> taskSeq < 'T >
71+
72+ /// <summary>
73+ /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function
74+ /// with the current index, ad infinitum, or until <see cref="Int32.MaxValue" /> is reached.
75+ /// Each element is saved after its initialization for successive access to
76+ /// <see cref="IAsyncEnumerator.Current" />, which will not re-evaluate the <paramref name="initializer" />. However,
77+ /// re-iterating the returned task sequence will re-evaluate the initialization function. The returned sequence may
78+ /// be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should
79+ /// not be accessed concurrently.
80+ /// </summary>
81+ ///
82+ /// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
83+ /// <returns>The resulting task sequence.</returns>
84+ val initInfinite : initializer : ( int -> 'T ) -> taskSeq < 'T >
85+
86+ /// <summary>
87+ /// Generates a new task sequence which, when iterated, will return successive elements by calling the given function
88+ /// with the current index, ad infinitum, or until <see cref="Int32.MaxValue" /> is reached.
89+ /// Each element is saved after its initialization for successive access to
90+ /// <see cref="IAsyncEnumerator.Current" />, which will not re-evaluate the <paramref name="initializer" />. However,
91+ /// re-iterating the returned task sequence will re-evaluate the initialization function. The returned sequence may
92+ /// be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should
93+ /// not be accessed concurrently.
94+ /// </summary>
95+ ///
96+ /// <param name="initializer">A function that generates an item in the sequence from a given index.</param>
97+ /// <returns>The resulting task sequence.</returns>
98+ val initInfiniteAsync : initializer : ( int -> #Task < 'T >) -> taskSeq < 'T >
99+
100+ /// <summary>
101+ /// Combines the given task sequence of task sequences and concatenates them end-to-end, to form a
102+ /// new flattened, single task sequence. Each task sequence is awaited item by item, before the next is iterated.
103+ /// </summary>
104+ ///
105+ /// <param name="sources">The input enumeration-of-enumerations.</param>
106+ /// <returns>The resulting task sequence.</returns>
107+ /// <exception cref="T:ArgumentNullException">Thrown when the input sequence is null.</exception>
108+ val concat : sources : taskSeq < #taskSeq < 'T >> -> taskSeq < 'T >
109+
35110 /// Returns taskSeq as an array. This function is blocking until the sequence is exhausted and will properly dispose of the resources.
36111 val toList : source : taskSeq < 'T > -> 'T list
37112
0 commit comments