feature request: N-ary map

Timothee Cour thelastmammoth at gmail.com
Fri Jun 21 16:04:41 PDT 2013


On Fri, Jun 21, 2013 at 3:57 PM, Diggory <diggsey at googlemail.com> wrote:

> On Friday, 21 June 2013 at 22:56:04 UTC, Andrei Alexandrescu wrote:
>
>> On 6/21/13 3:55 PM, Andrei Alexandrescu wrote:
>>
>>> On 6/21/13 3:45 PM, Timothee Cour wrote:
>>>
>>>> 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.
>>>>
>>>
>>> Actually map used to do that in its early days. Then I figured composing
>>> with chain() is even better.
>>>
>>> chain(r1, r2, r3).map...
>>>
>>> Andrei
>>>
>>
>> Wait, I think I misunderstood...
>>
>> Andrei
>>
>
> You can use "zip" from std.range.
>

I know, please re-read the original post:

before:
  zip(a,b).map!(u=>absDiff(u[0],u[1])).reduce!fun;
after:
  map!absDiff(a,b).reduce!fun;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130621/3206e821/attachment.html>


More information about the Digitalmars-d mailing list