Conversation
|
FYI: This operator has been included in SuperLinq 4.0.0, which has now been published. |
atifaziz
left a comment
There was a problem hiding this comment.
@matachi Thanks for contributing this and sorry for having taken so long to get back with a review. Usually, I don't pay attention to a new PR unless the CI build errors are fixed. Anyway, since master had moved on considerably since this PR was opened, I've aligned it with a merge and added my review. Hope you'll find the time to address the comments soon.
| /// ("foo", false"), ("bar", true) and ("baz", true), in turn. | ||
| /// </example> | ||
|
|
||
| public static IEnumerable<(TSource Item, TResult Result)> ZipMap<TSource, TResult>( |
There was a problem hiding this comment.
I think the first tuple element should be named Source or Input instead of Item. Thoughts?
| foreach (var item in source) | ||
| { | ||
| yield return (item, func(item)); | ||
| } |
There was a problem hiding this comment.
The NullArgumentTest tests are breaking. The fix is to validate the arguments eagerly and wrap the iterator in a local function as follows (otherwise arguments are validated when the sequence is iterated rather than when ZipMap is called):
| foreach (var item in source) | |
| { | |
| yield return (item, func(item)); | |
| } | |
| return _(); IEnumerable<(TSource, TResult)> _() | |
| { | |
| foreach (var item in source) | |
| { | |
| yield return (item, func(item)); | |
| } | |
| } |
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Co-authored-by: Atif Aziz <code@raboof.com>
Implementation of
ZipMapproposed in #661.