Open XDracam opened 5 years ago
We would like a tupleList.Select((a, b) => a + b) method on every n-tuple which takes n arguments. This makes writing functional mappings a lot nicer when working with tuples, since lambda parameter lists do not support destructuring (yet?).
tupleList.Select((a, b) => a + b)
static IEnumerable<TRes> Select<TSource1, TSource2, TRes>(this IEnumerable<(TSource1, TSource2)> source, Func<TSource1, TSource2, TRes> fn) => source.Select(t => fn(t.Item1, t.Item2));
Analogue implementations for tuples of size 3, since we would consider any larger tuples to be better represented by a custom struct.
We would like a
tupleList.Select((a, b) => a + b)
method on every n-tuple which takes n arguments. This makes writing functional mappings a lot nicer when working with tuples, since lambda parameter lists do not support destructuring (yet?).Analogue implementations for tuples of size 3, since we would consider any larger tuples to be better represented by a custom struct.