I'd like to support N-ary map, ie std.algorithm.map that takes 1 or more ranges as arguments and operates lazily on those.
example: suppose we have a 2 argument function, eg : auto absDiff(a,b){...}
before:
zip(a,b).map!(u=>absDiff(u[0],u[1])).reduce!fun;
after:
map!absDiff(a,b).reduce!fun;
currently the signature of std.algorithm.map is:
auto map(Range)(Range r) if (isInputRange!(Unqual!Range));
new signature:
auto map(Range...)(Range r) if (Range.length>0 && allSatisfy!(isInputRange!Unqual,Range));
implementation:
it can be implemented using zip and expand, but there is room for more optimization potentially. Or will LDC/GDC be smart enough to have zero overhead when using zip?
advantages:
concise and natural syntax
reduces need for zip, and adds optimization opportunities
reduces need for using foreach when zip is too confusing