Skip to content

Commit

Permalink
Merge branch 'master' into moverange
Browse files Browse the repository at this point in the history
  • Loading branch information
Scharps committed Nov 23, 2023
2 parents 719597a + 2c498f5 commit 12e4d6b
Show file tree
Hide file tree
Showing 141 changed files with 9,867 additions and 5,623 deletions.
2 changes: 1 addition & 1 deletion Docs/SuperLinq.Docs/SuperLinq.Docs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="DocFx.App" Version="2.73.0" />
<PackageReference Include="DocFx.App" Version="2.73.2" />
</ItemGroup>

</Project>
71 changes: 44 additions & 27 deletions Generators/SuperLinq.Generator/Cartesian.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,37 @@ public static partial class SuperEnumerable
{
{{~ for $i in 2..($arity.size - 1) ~}}
/// <summary>
/// Returns the Cartesian product of {{ $arity[$i] }} sequences by enumerating all
/// possible combinations of one item from each sequence, and applying
/// a user-defined projection to the items in a given combination.
/// Returns the Cartesian product of {{ $arity[$i] }} sequences by enumerating all possible combinations of one item from
/// each sequence, and applying a user-defined projection to the items in a given combination.
/// </summary>
/// <typeparam name="TResult">
/// The type of the elements of the result sequence.</typeparam>
/// <param name="resultSelector">A projection function that combines
/// elements from all of the sequences.</param>
/// <returns>A sequence of elements returned by
/// <paramref name="resultSelector"/>.</returns>
/// The type of the elements of the result sequence.
/// </typeparam>
/// <param name="resultSelector">
/// A projection function that combines elements from all of the sequences.
/// </param>
/// <returns>
/// A sequence of elements returned by <paramref name="resultSelector"/>.
/// </returns>
/// <remarks>
/// <para>
/// The method returns items in the same order as a nested foreach
/// loop, but all sequences cached when iterated over. The cache is
/// then re-used for any subsequent iterations.</para>
/// The method returns items in the same order as a nested foreach loop, but all sequences cached when iterated
/// over. The cache is then re-used for any subsequent iterations.
/// </para>
/// <para>
/// This method uses deferred execution and stream its results.</para>
/// This method uses deferred execution and stream its results.
/// </para>
/// </remarks>
/// <exception cref="global::System.ArgumentNullException"><paramref name="resultSelector"/> or any of the input sequences is null.</exception>
/// <exception cref="global::System.ArgumentNullException">
/// <paramref name="resultSelector"/> or any of the input sequences is <see langword = "null"/>.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{$j}}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name="T{{$j}}">
/// The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name="{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<TResult> Cartesian<{{ for $j in 1..$i }}T{{$j}}, {{ end }}TResult>(this
{{~ for $j in 1..$i ~}}
Expand Down Expand Up @@ -74,24 +83,32 @@ public static partial class SuperEnumerable
}

/// <summary>
/// Returns the Cartesian product of {{ $arity[$i] }} sequences by enumerating all
/// possible combinations of one item from each sequence.
/// Returns the Cartesian product of {{ $arity[$i] }} sequences by enumerating all possible combinations of one item from
/// each sequence.
/// </summary>
/// <returns>A sequence of
/// <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" />
/// containing elements from each of the sequences.</returns>
/// <returns>
/// A sequence of <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" /> containing elements from each of the
/// sequences.
/// </returns>
/// <remarks>
/// <para>
/// The method returns items in the same order as a nested foreach
/// loop, but all sequences are cached when iterated over. The cache
/// is then re-used for any subsequent iterations.</para>
/// The method returns items in the same order as a nested foreach loop, but all sequences are cached when
/// iterated over. The cache is then re-used for any subsequent iterations.
/// </para>
/// <para>
/// This method uses deferred execution and stream its results.</para>
/// This method uses deferred execution and stream its results.
/// </para>
/// </remarks>
/// <exception cref="global::System.ArgumentNullException">Any of the input sequences is null.</exception>
/// <exception cref="global::System.ArgumentNullException">
/// Any of the input sequences is <see langword = "null"/>.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{$j}}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name="T{{$j}}">
/// The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name="{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<({{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }})>
Cartesian<{{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }}>(this
Expand Down
82 changes: 50 additions & 32 deletions Generators/SuperLinq.Generator/EquiZip.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,41 @@ namespace SuperLinq;
public static partial class SuperEnumerable
{
{{~ for $i in 2..4 ~}}
/// <summary>
/// <summary>
/// <para>
/// Applies a specified function to the corresponding elements of {{ $ordinals[$i] }} sequences,
/// producing a sequence of the results.</para>
/// Applies a specified function to the corresponding elements of second sequences, producing a sequence of the
/// results.
/// </para>
/// <para>
/// The resulting sequence has the same length as the input sequences.
/// If the input sequences are of different lengths, an exception is thrown.</para>
/// </summary>
/// <typeparam name="TResult">
/// The type of the elements of the result sequence.</typeparam>
/// <param name="resultSelector">A projection function that combines
/// elements from all of the sequences.</param>
/// <returns>A sequence of elements returned by <paramref name="resultSelector"/>.</returns>
/// <remarks>
/// This method uses deferred execution and stream its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException"><paramref name="resultSelector"/> or any of the input sequences is null.</exception>
/// <exception cref="global::System.InvalidOperationException">
/// Any of the input sequences are shorter than the others.
/// The resulting sequence has the same length as the input sequences. If the input sequences are of different
/// lengths, an exception is thrown.
/// </para>
/// </summary>
/// <typeparam name = "TResult">
/// The type of the elements of the result sequence.
/// </typeparam>
/// <param name = "resultSelector">
/// A projection function that combines elements from all of the sequences.
/// </param>
/// <returns>
/// A sequence of elements returned by <paramref name = "resultSelector"/>.
/// </returns>
/// <remarks>
/// This method uses deferred execution and stream its results.
/// </remarks>
/// <exception cref = "global::System.ArgumentNullException">
/// <paramref name = "resultSelector"/> or any of the input sequences is <see langword = "null"/>.
/// </exception>
/// <exception cref = "global::System.InvalidOperationException">
/// Any of the input sequences are shorter than the others.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name = "T{{ $cardinals[$j] }}">
/// The type of the elements of <paramref name = "{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name = "{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<TResult> EquiZip<{{ for $j in 1..$i }}T{{ $cardinals[$j] }}, {{ end }}TResult>(this
{{~ for $j in 1..$i ~}}
Expand Down Expand Up @@ -109,23 +121,29 @@ public static partial class SuperEnumerable
}
}

/// <summary>
/// Joins the corresponding elements of {{ $ordinals[$i] }} sequences,
/// producing a sequence of tuples containing them.
/// <summary>
/// Joins the corresponding elements of second sequences, producing a sequence of tuples containing them.
/// </summary>
/// <returns>A sequence of
/// <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" />
/// containing corresponding elements from each of the sequences.</returns>
/// <returns>
/// A sequence of <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" />
/// containing corresponding elements from each of the sequences.
/// </returns>
/// <remarks>
/// This method uses deferred execution and stream its results.
/// This method uses deferred execution and stream its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException">Any of the input sequences is null.</exception>
/// <exception cref="global::System.InvalidOperationException">
/// Any of the input sequences are shorter than the others.
/// </exception>
/// <exception cref = "global::System.ArgumentNullException">
/// Any of the input sequences is null.
/// </exception>
/// <exception cref = "global::System.InvalidOperationException">
/// Any of the input sequences are shorter than the others.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{ $cardinals[$j] }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name="T{{ $cardinals[$j] }}">
/// The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name="{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<({{~ for $j in 1..$i ~}}T{{ $cardinals[$j] }}{{ if !for.last }},{{ end }}{{ end }})>
EquiZip<{{~ for $j in 1..$i ~}}T{{ $cardinals[$j] }}{{ if !for.last }},{{ end }}{{ end }}>(this
Expand Down
30 changes: 21 additions & 9 deletions Generators/SuperLinq.Generator/Fold.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,31 @@ public static partial class SuperEnumerable
{
{{~ for $i in 1..16 ~}}
/// <summary>
/// Returns the result of applying a function to a sequence of {{$i}} element{{if $i != 1}}s{{end}}.
/// Returns the result of applying a function to a sequence of {{$i}} element{{if $i != 1}}s{{end}}.
/// </summary>
/// <remarks>
/// This operator uses immediate execution and buffers as many items of the source sequence as necessary.
/// This operator uses immediate execution and buffers as many items of the source sequence as necessary.
/// </remarks>
/// <typeparam name="T">Type of element in the source sequence</typeparam>
/// <typeparam name="TResult">Type of the result</typeparam>
/// <param name="source">The sequence of items to fold.</param>
/// <param name="folder">Function to apply to the elements in the sequence.</param>
/// <returns>The folded value returned by <paramref name="folder"/>.</returns>
/// <exception cref="global::System.ArgumentNullException"><paramref name="source"/> or <paramref name="folder"/> is null.</exception>
/// <typeparam name="T">
/// Type of element in the source sequence
/// </typeparam>
/// <typeparam name="TResult">
/// Type of the result
/// </typeparam>
/// <param name="source">
/// The sequence of items to fold.
/// </param>
/// <param name="folder">
/// Function to apply to the elements in the sequence.
/// </param>
/// <returns>
/// The folded value returned by <paramref name="folder"/>.
/// </returns>
/// <exception cref="global::System.ArgumentNullException">
/// <paramref name="source"/> or <paramref name="folder"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="global::System.InvalidOperationException">
/// <paramref name="source"/> does not contain exactly {{$i}} element{{if $i != 1}}s{{end}}.
/// <paramref name="source"/> does not contain exactly {{$i}} element{{if $i != 1}}s{{end}}.
/// </exception>
public static TResult Fold<T, TResult>(this global::System.Collections.Generic.IEnumerable<T> source, global::System.Func<
{{~ for $j in 1..$i ~}}
Expand Down
22 changes: 12 additions & 10 deletions Generators/SuperLinq.Generator/ToDelimitedString.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@ public static partial class SuperEnumerable
{
{{~ for t in types ~}}
/// <summary>
/// Creates a delimited string from a sequence of values and
/// a given delimiter.
/// Creates a delimited string from a sequence of values and a given delimiter.
/// </summary>
/// <param name="source">The sequence of items to delimit. Each is converted to a string using the
/// simple <c>ToString()</c> conversion.</param>
/// <param name="delimiter">The delimiter to inject between elements.</param>
/// <param name="source">
/// The sequence of items to delimit. Each is converted to a string using the simple <c>ToString()</c>
/// conversion.
/// </param>
/// <param name="delimiter">
/// The delimiter to inject between elements.
/// </param>
/// <returns>
/// A string that consists of the elements in <paramref name="source"/>
/// delimited by <paramref name="delimiter"/>. If the source sequence
/// is empty, the method returns an empty string.
/// A string that consists of the elements in <paramref name = "source"/> delimited by <paramref name = "delimiter"/>.
/// If the source sequence is empty, the method returns an empty string.
/// </returns>
/// <exception cref="global::System.ArgumentNullException">
/// <paramref name="source"/> or <paramref name="delimiter"/> is <see langword="null"/>.
/// <paramref name="source"/> or <paramref name="delimiter"/> is <see langword="null"/>.
/// </exception>
/// <remarks>
/// This operator uses immediate execution and effectively buffers the sequence.
/// This operator uses immediate execution and effectively buffers the sequence.
/// </remarks>
public static global::System.String ToDelimitedString(this global::System.Collections.Generic.IEnumerable<{{t}}> source, global::System.String delimiter)
{
Expand Down
75 changes: 44 additions & 31 deletions Generators/SuperLinq.Generator/ZipLongest.sbntxt
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,32 @@ public static partial class SuperEnumerable

{{~ for $i in 2..4 ~}}
/// <summary>
/// Returns a projection of tuples, where each tuple contains the N-th
/// element from each of the argument sequences. The resulting sequence
/// will always be as long as the longest of input sequences where the
/// default value of each of the shorter sequence element types is used
/// for padding.
/// Returns a projection of tuples, where each tuple contains the N-th element from each of the argument
/// sequences. The resulting sequence will always be as long as the longest of input sequences where the default
/// value of each of the shorter sequence element types is used for padding.
/// </summary>
/// <typeparam name="TResult">
/// The type of the elements of the result sequence.</typeparam>
/// <param name="resultSelector">A projection function that combines
/// elements from all of the sequences.</param>
/// <returns>A sequence of elements returned by <paramref name="resultSelector"/>.</returns>
/// <remarks>
/// This method uses deferred execution and streams its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException"><paramref name="resultSelector"/> or any of the input sequences is null.</exception>
/// <typeparam name = "TResult">
/// The type of the elements of the result sequence.
/// </typeparam>
/// <param name = "resultSelector">
/// A projection function that combines elements from all of the sequences.
/// </param>
/// <returns>
/// A sequence of elements returned by <paramref name = "resultSelector"/>.
/// </returns>
/// <remarks>
/// This method uses deferred execution and streams its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException">
/// <paramref name="resultSelector"/> or any of the input sequences is <see langword="null"/>.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{ $j }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name="T{{ $j }}">
/// The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name="{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<TResult> ZipLongest<{{ for $j in 1..$i }}T{{ $j }}, {{ end }}TResult>(this
{{~ for $j in 1..$i ~}}
Expand Down Expand Up @@ -101,22 +109,27 @@ public static partial class SuperEnumerable
}

/// <summary>
/// Returns a projection of tuples, where each tuple contains the N-th
/// element from each of the argument sequences. The resulting sequence
/// will always be as long as the longest of input sequences where the
/// default value of each of the shorter sequence element types is used
/// for padding.
/// </summary>
/// <returns>A sequence of
/// <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" />
/// containing corresponding elements from each of the sequences.</returns>
/// <remarks>
/// This method uses deferred execution and streams its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException">Any of the input sequences is null.</exception>
/// Returns a projection of tuples, where each tuple contains the N-th element from each of the argument
/// sequences. The resulting sequence will always be as long as the longest of input sequences where the default
/// value of each of the shorter sequence element types is used for padding.
/// </summary>
/// <returns>
/// A sequence of <see cref="global::System.ValueTuple{ {{~ for $j in 1..$i ~}}T{{$j}}{{ if !for.last }},{{ end }}{{ end }} }" /> containing corresponding elements from each
/// of the sequences.
/// </returns>
/// <remarks>
/// This method uses deferred execution and streams its results.
/// </remarks>
/// <exception cref="global::System.ArgumentNullException">
/// Any of the input sequences is <see langword="null"/>.
/// </exception>
{{~ for $j in 1..$i ~}}
/// <typeparam name="T{{ $j }}">The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.</typeparam>
/// <param name="{{ $ordinals[$j] }}">The {{ $ordinals[$j] }} sequence of elements.</param>
/// <typeparam name="T{{ $j }}">
/// The type of the elements of <paramref name="{{ $ordinals[$j] }}" />.
/// </typeparam>
/// <param name="{{ $ordinals[$j] }}">
/// The {{ $ordinals[$j] }} sequence of elements.
/// </param>
{{~ end ~}}
public static global::System.Collections.Generic.IEnumerable<({{~ for $j in 1..$i ~}}T{{ $j }}?{{ if !for.last }},{{ end }}{{ end }})>
ZipLongest<{{~ for $j in 1..$i ~}}T{{ $j }}{{ if !for.last }},{{ end }}{{ end }}>(this
Expand Down
Loading

0 comments on commit 12e4d6b

Please sign in to comment.