@@ -5,28 +5,31 @@ namespace SuperLinq;
5
5
public static partial class SuperEnumerable
6
6
{
7
7
/// <summary>
8
- /// Performs a right-associative scan (inclusive prefix) on a sequence of elements.
9
- /// This operator is the right-associative version of the
10
- /// <see cref="Scan{TSource}(IEnumerable{TSource}, Func{TSource, TSource, TSource})"/> LINQ operator.
8
+ /// Performs a right-associative scan (inclusive prefix) on a sequence of elements. This operator is the
9
+ /// right-associative version of the <see cref="Scan{TSource}(IEnumerable{TSource}, Func{TSource, TSource,
10
+ /// TSource})"/> LINQ operator.
11
11
/// </summary>
12
- /// <typeparam name="TSource">Type of elements in source sequence.</typeparam>
13
- /// <param name="source">Source sequence.</param>
12
+ /// <typeparam name="TSource">
13
+ /// Type of elements in source sequence.
14
+ /// </typeparam>
15
+ /// <param name="source">
16
+ /// Source sequence.
17
+ /// </param>
14
18
/// <param name="func">
15
- /// A right-associative accumulator function to be invoked on each element.
16
- /// Its first argument is the current value in the sequence; second argument is the previous accumulator value.
19
+ /// A right-associative accumulator function to be invoked on each element. Its first argument is the current
20
+ /// value in the sequence; second argument is the previous accumulator value.
17
21
/// </param>
18
- /// <returns>The scanned sequence.</returns>
19
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is <see langword="null"/>.</exception>
20
- /// <exception cref="ArgumentNullException"><paramref name="func"/> is <see langword="null"/>.</exception>
21
- /// <example>
22
- /// <code><![CDATA[
23
- /// var result = Enumerable.Range(1, 5).Select(i => i.ToString()).ScanRight((a, b) => $"({a}+{b})");
24
- /// ]]></code>
25
- /// The <c>result</c> variable will contain <c>[ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ]</c>.
26
- /// </example>
22
+ /// <returns>
23
+ /// The scanned sequence.
24
+ /// </returns>
25
+ /// <exception cref="ArgumentNullException">
26
+ /// <paramref name="source"/> or <paramref name="func"/> is <see langword="null"/>.
27
+ /// </exception>
27
28
/// <remarks>
28
- /// This operator uses deferred execution and streams its results.
29
- /// Source sequence is consumed greedily when an iteration of the resulting sequence begins.
29
+ /// <para>
30
+ /// This method is implemented by using deferred execution. However, <paramref name="source"/> will be consumed
31
+ /// in it's entirety immediately when first element of the returned sequence is consumed.
32
+ /// </para>
30
33
/// </remarks>
31
34
public static IEnumerable < TSource > ScanRight < TSource > ( this IEnumerable < TSource > source , Func < TSource , TSource , TSource > func )
32
35
{
@@ -99,29 +102,37 @@ public override void CopyTo(T[] array, int arrayIndex)
99
102
}
100
103
101
104
/// <summary>
102
- /// Performs a right-associative scan (inclusive prefix) on a sequence of elements.
103
- /// The specified seed value is used as the initial accumulator value.
104
- /// This operator is the right-associative version of the
105
- /// <see cref="Scan{TSource, TState}(IEnumerable{TSource}, TState, Func{TState, TSource, TState})"/> LINQ operator.
105
+ /// Performs a right-associative scan (inclusive prefix) on a sequence of elements. This operator is the
106
+ /// right-associative version of the <see cref="Scan{TSource}(IEnumerable{TSource}, Func{TSource, TSource,
107
+ /// TSource})"/> LINQ operator.
106
108
/// </summary>
107
- /// <typeparam name="TSource">The type of the elements of source.</typeparam>
108
- /// <typeparam name="TAccumulate">The type of the accumulator value.</typeparam>
109
- /// <param name="source">Source sequence.</param>
110
- /// <param name="seed">The initial accumulator value.</param>
111
- /// <param name="func">A right-associative accumulator function to be invoked on each element.</param>
112
- /// <returns>The scanned sequence.</returns>
113
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is <see langword="null"/>.</exception>
114
- /// <exception cref="ArgumentNullException"><paramref name="seed"/> is <see langword="null"/>.</exception>
115
- /// <exception cref="ArgumentNullException"><paramref name="func"/> is <see langword="null"/>.</exception>
116
- /// <example>
117
- /// <code><![CDATA[
118
- /// var result = Enumerable.Range(1, 4).ScanRight("5", (a, b) => string.Format("({0}/{1})", a, b));
119
- /// ]]></code>
120
- /// The <c>result</c> variable will contain <c>[ "(1+(2+(3+(4+5))))", "(2+(3+(4+5)))", "(3+(4+5))", "(4+5)", "5" ]</c>.
121
- /// </example>
109
+ /// <typeparam name="TSource">
110
+ /// Type of elements in source sequence.
111
+ /// </typeparam>
112
+ /// <typeparam name="TAccumulate">
113
+ /// Type of the state accumulator.
114
+ /// </typeparam>
115
+ /// <param name="source">
116
+ /// Source sequence.
117
+ /// </param>
118
+ /// <param name="func">
119
+ /// A right-associative accumulator function to be invoked on each element. Its first argument is the current
120
+ /// value in the sequence; second argument is the previous accumulator value.
121
+ /// </param>
122
+ /// <param name="seed">
123
+ /// The initial accumulator value.
124
+ /// </param>
125
+ /// <returns>
126
+ /// The scanned sequence.
127
+ /// </returns>
128
+ /// <exception cref="ArgumentNullException">
129
+ /// <paramref name="source"/> or <paramref name="func"/> is <see langword="null"/>.
130
+ /// </exception>
122
131
/// <remarks>
123
- /// This operator uses deferred execution and streams its results.
124
- /// Source sequence is consumed greedily when an iteration of the resulting sequence begins.
132
+ /// <para>
133
+ /// This method is implemented by using deferred execution. However, <paramref name="source"/> will be consumed
134
+ /// in it's entirety immediately when first element of the returned sequence is consumed.
135
+ /// </para>
125
136
/// </remarks>
126
137
public static IEnumerable < TAccumulate > ScanRight < TSource , TAccumulate > ( this IEnumerable < TSource > source , TAccumulate seed , Func < TSource , TAccumulate , TAccumulate > func )
127
138
{
0 commit comments