Orace
Orace
`Interleave` may also have fluent parametrization. - `WithUnbalancedPadStrategy(paddingValue = default)` - `WithUnbalancedThrowStrategy()` (`EquiInterleave` #695 ) - `WithUnbalancedStopStrategy()` (`InterleaveShortest` ?) - `WithUnbalancedSkipStrategy()`
The overloads can be: ```C# (bool? isHomogeneous, TSource value) IsHomogeneous(this IEnumerable source); (bool? isHomogeneous, TSource value) IsHomogeneous(this IEnumerable source, IEqualitityComparer comparer); (bool? isHomogeneous, TResult value) IsHomogeneous(this IEnumerable source, Func selector);...
An implementation of `IsHomogeneous` is available in #700: https://github.com/morelinq/MoreLINQ/blob/365adcc40a94417299fc6101e361db959f04c6cd/MoreLinq/EquiInterleave.cs#L94-L110
@atifaziz, it is ~but with O(1) memory usage.~
> > @atifaziz, it is ~but with O(1) memory usage.~ > > Second thoughts? Yep, distinc + TrySingle doesn't cost that much. I'm ok with any name proposition.
`HomogeneousOrEmpty` will not distinct empty from non-homogeneous. Here an example of use (an overload with selector predicate may be more adapted here): https://github.com/morelinq/MoreLINQ/blob/365adcc40a94417299fc6101e361db959f04c6cd/MoreLinq/EquiInterleave.cs#L73-L86
> > `HomogeneousOrEmpty` will not distinct empty from non-homogeneous. > > Sorry, I don't understand. If the sequence is empty my proposal return null If it's not homogeneous it's return...
Indeed it's a 3 state. And this looks like the discussion about TrySingle. The 3 new parameters really add complexity, in my use case example it's obvious: ```C# var (isHomogeneous,...
An other option is (optional via overloads) out parameters: ```C# bool IsHomogeneous(this IEnumerable source, out bool hasValue, out T value); ``` But with the overloads to add a selector and...
> > The 3 new parameters really add complexity, in my use case example it's obvious: > > ```cs > > var (isHomogeneous, hasNext) = enumerators.Select(e => e.MoveNext()).IsHomogeneous(((bool?)null, default), (false,...