-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82eb04a
commit bc43d2e
Showing
19 changed files
with
719 additions
and
153 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.Fold.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 1 element using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold1.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 2 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold2.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 3 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold3.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 4 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold4.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 5 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold5.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 6 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold6.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 7 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold7.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 8 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold8.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 9 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold9.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 10 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold10.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 11 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold11.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 12 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold12.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 13 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold13.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 14 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold14.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 15 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold15.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Fold``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to apply a projection to a sequence of 16 elements using `Fold`. | ||
[!code-csharp[](SuperLinq/Fold/Fold16.linq#L6-)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 1); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a) => a); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 10); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j) => | ||
a + b + c + d + e + f + g + h + i + j); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 55 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 11); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k) => | ||
a + b + c + d + e + f + g + h + i + j + k); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 66 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 12); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k, l) => | ||
a + b + c + d + e + f + g + h + i + j + k + l); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 78 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 13); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k, l, m) => | ||
a + b + c + d + e + f + g + h + i + j + k + l + m); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 91 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 14); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k, l, m, n) => | ||
a + b + c + d + e + f + g + h + i + j + k + l + m + n); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 15); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) => | ||
a + b + c + d + e + f + g + h + i + j + k + l + m + n + o); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 16); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) => | ||
a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 136 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 2); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b) => a + b); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 3); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c) => a + b + c); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 4); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d) => a + b + c + d); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 5); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e) => a + b + c + d + e); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 6); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f) => a + b + c + d + e + f); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 21 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 7); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g) => | ||
a + b + c + d + e + f + g); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 8); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h) => | ||
a + b + c + d + e + f + g + h); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 36 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(1, 9); | ||
|
||
// Fold a sequence into a single value. | ||
var result = sequence | ||
.Fold((a, b, c, d, e, f, g, h, i) => | ||
a + b + c + d + e + f + g + h + i); | ||
|
||
Console.WriteLine(result); | ||
|
||
// This code produces the following output: | ||
// 45 |
Oops, something went wrong.