@@ -5,40 +5,38 @@ namespace SuperLinq;
5
5
public static partial class SuperEnumerable
6
6
{
7
7
/// <summary>
8
- /// Performs a pre-scan (exclusive prefix sum) on a sequence of elements.
8
+ /// Performs a pre-scan (exclusive prefix sum) on a sequence of elements.
9
9
/// </summary>
10
+ /// <typeparam name="TSource">
11
+ /// Type of elements in source sequence
12
+ /// </typeparam>
13
+ /// <param name="source">
14
+ /// Source sequence
15
+ /// </param>
16
+ /// <param name="transformation">
17
+ /// An accumulator function to be invoked on each element.
18
+ /// </param>
19
+ /// <param name="identity">
20
+ /// The initial accumulator value.
21
+ /// </param>
22
+ /// <exception cref="ArgumentNullException">
23
+ /// <paramref name="source"/> or <paramref name="transformation"/> is <see langword="null"/>.
24
+ /// </exception>
25
+ /// <returns>
26
+ /// The scanned sequence
27
+ /// </returns>
10
28
/// <remarks>
11
29
/// <para>
12
- /// An exclusive prefix sum returns an equal-length sequence where the
13
- /// N-th element is the sum of the first N-1 input elements (the first
14
- /// element is a special case, it is set to the identity). More
15
- /// generally, the pre-scan allows any commutative binary operation,
16
- /// not just a sum.
30
+ /// An exclusive prefix scan returns an equal-length sequence where the N-th element is the aggregation of the
31
+ /// first N-1 input elements, where the first element is simply the <paramref name="identity"/> value.
17
32
/// </para>
18
33
/// <para>
19
- /// The inclusive version of PreScan is <see cref="ScanEx {TSource}"/>.
34
+ /// The inclusive version of PreScan is <see cref="Scan {TSource}"/>.
20
35
/// </para>
21
36
/// <para>
22
- /// This operator uses deferred execution and streams its result.
37
+ /// This operator uses deferred execution and streams its result.
23
38
/// </para>
24
- /// <example>
25
- /// <code><![CDATA[
26
- /// int[] values = { 1, 2, 3, 4 };
27
- /// var prescan = values.PreScan((a, b) => a + b, 0);
28
- /// var scan = values.Scan((a, b) => a + b);
29
- /// ]]></code>
30
- /// <c>prescan</c> will yield <c>{ 0, 1, 3, 6 }</c>, while <c>scan</c>
31
- /// will yield <c>{ 1, 3, 6, 10 }</c>. This shows the relationship
32
- /// between the inclusive and exclusive prefix sum.
33
- /// </example>
34
39
/// </remarks>
35
- /// <typeparam name="TSource">Type of elements in source sequence</typeparam>
36
- /// <param name="source">Source sequence</param>
37
- /// <param name="transformation">Transformation operation</param>
38
- /// <param name="identity">Identity element (see remarks)</param>
39
- /// <returns>The scanned sequence</returns>
40
- /// <exception cref="ArgumentNullException"><paramref name="source"/> is null</exception>
41
- /// <exception cref="ArgumentNullException"><paramref name="transformation"/> is null</exception>
42
40
public static IEnumerable < TSource > PreScan < TSource > (
43
41
this IEnumerable < TSource > source ,
44
42
Func < TSource , TSource , TSource > transformation ,
0 commit comments