Skip to content

Commit

Permalink
Hint at other version in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed Jan 14, 2025
1 parent 1da0f3e commit ce7a408
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Funcky/Sequence/Sequence.CycleMaterialized.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ namespace Funcky;

public static partial class Sequence
{
/// <inheritdoc cref="CycleRange{TSource}(IEnumerable{TSource})"/>
/// <summary>
/// Generates a sequence that contains the same sequence of elements over and over again as an endless generator.
/// </summary>
/// <typeparam name="TSource">Type of the elements to be cycled.</typeparam>
/// <param name="source">The sequence of elements which are cycled. Throws an exception if the sequence is empty.</param>
/// <returns>Returns an infinite IEnumerable repeating the same sequence of elements.</returns>
/// <remarks>Use <see cref="CycleRange{TSource}"/> if you need to cycle a lazy sequence.</remarks>
[Pure]
public static IEnumerable<TSource> CycleMaterialized<TSource>(IReadOnlyCollection<TSource> source)
=> source.Count > 0
Expand Down
1 change: 1 addition & 0 deletions Funcky/Sequence/Sequence.CycleRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static partial class Sequence
/// <typeparam name="TSource">Type of the elements to be cycled.</typeparam>
/// <param name="source">The sequence of elements which are cycled. Throws an exception if the sequence is empty.</param>
/// <returns>Returns an infinite IEnumerable repeating the same sequence of elements.</returns>
/// <remarks>Use <see cref="CycleMaterialized{TSource}"/> if you need to cycle an already materialized sequence.</remarks>
[Pure]
public static IBuffer<TSource> CycleRange<TSource>(IEnumerable<TSource> source)
=> CycleBuffer.Create(source);
Expand Down
9 changes: 8 additions & 1 deletion Funcky/Sequence/Sequence.RepeatMaterialized.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ namespace Funcky;

public static partial class Sequence
{
/// <inheritdoc cref="RepeatRange{TSource}(IEnumerable{TSource},int)"/>
/// <summary>
/// Generates a sequence that contains the same sequence of elements the given number of times.
/// </summary>
/// <typeparam name="TSource">Type of the elements to be repeated.</typeparam>
/// <param name="source">The sequence of elements to be repeated.</param>
/// <param name="count">The number of times to repeat the value in the generated sequence.</param>
/// <returns>Returns an infinite IEnumerable cycling through the same elements.</returns>
/// <remarks>Use <see cref="RepeatRange{TSource}"/> if you need to cycle a lazy sequence.</remarks>
[Pure]
public static IEnumerable<TSource> RepeatMaterialized<TSource>(IReadOnlyCollection<TSource> source, int count)
=> Enumerable.Repeat(source, count).SelectMany(Identity);
Expand Down
1 change: 1 addition & 0 deletions Funcky/Sequence/Sequence.RepeatRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public static partial class Sequence
/// <param name="source">The sequence of elements to be repeated.</param>
/// <param name="count">The number of times to repeat the value in the generated sequence.</param>
/// <returns>Returns an infinite IEnumerable cycling through the same elements.</returns>
/// <remarks>Use <see cref="RepeatMaterialized{TSource}"/> if you need to cycle an already materialized sequence.</remarks>
[Pure]
public static IBuffer<TSource> RepeatRange<TSource>(IEnumerable<TSource> source, int count)
=> CycleBuffer.Create(source, count);
Expand Down

0 comments on commit ce7a408

Please sign in to comment.