Make a hash out of two ranges

Philippe Sigaud philippe.sigaud at gmail.com
Thu Feb 28 11:03:43 PST 2013


On Thu, Feb 28, 2013 at 4:14 PM, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> On 2/28/13, Chris Cain <clcain at uncg.edu> wrote:
>> Aha, I see now. Here you go:
>>
>>      zip([1,3], [2,4])
>>          .map!(e => [e[0] : e[1]])()
>>          .writeln();
>
> Thanks, I figured this out too by now. :)
>
> But it's definitely nicer having the a/b syntax. I guess I could just
> overload my map against the phobos map.

Oh, that must be one of the first thing I coded in D, like, 4 years
ago :) Multi-range map + filter + reduce.
Here it is:

https://github.com/PhilippeSigaud/dranges/blob/master/algorithm.d#L176

Ah, good times :) That must be much easier now, since Phobos and DMD
are quite better.


More information about the Digitalmars-d-learn mailing list