[Issue 8715] zipWith

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 23 18:03:50 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8715



--- Comment #3 from timon.gehr at gmx.ch 2012-09-23 18:04:46 PDT ---
(In reply to comment #2)
> A simpler alternative idea is to just extend zip() to optionally accept a
> function/constructor (it's also good for map() to accept a struct name):
> 
> import std.range;
> void main() {
>     auto r1 = zip!q{a + b}([1,2,3], [10,20,30]);
>     static struct Vec { int x, y; }
>     auto r2 = zip!Vec([1,2,3], [10,20,30]);
> }

I prefer this. 'zip' would become 'zipWith' with a default template argument of
'tuple'. (map already accepts a struct with an appropriate constructor as that
fits the 'callable' definition.)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list