Skip to content

Conversation

@ColmBhandal
Copy link
Owner

@ColmBhandal ColmBhandal commented Feb 21, 2022

Description

Added 4 ZipEnum methods on one/zero-based arrays and their 2D equivalents. Added unit tests for all. Also extended IEnumerable with some supporting extension methods.

TODO

Copy link
Collaborator

@hctrdev hctrdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

/// in all the arrays.</returns>
public static TResult[,] ZipEnum<TVal, TOther, TResult>(this TVal[,] array, Func<TVal, IEnumerable<TOther>, TResult> zipper, IEnumerable<TOther[,]> others)
{
int minRows = others.Select(o => o.GetLength(0)).UnionMin(array.GetLength(0).AsSingleton());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to do the .Union first and then a Min?
Something like:

others.Select(o => o.GetLength(0)).Union(array.GetLength(0)).Min();

Or even:

others.Union(array).Select(o => o.GetLength(0)).Min();

It might be slightly clearer and more standard. The same applies to the other places that use this format.

Removed Union Min extension function
Marked union max as obsolete & specified to use Union followed by Max for this
hctrdev
hctrdev previously approved these changes Feb 21, 2022
@ColmBhandal ColmBhandal merged commit 51f992c into develop Feb 21, 2022
@ColmBhandal ColmBhandal deleted the feature/zip-fold branch February 21, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZipEnum

3 participants