Associative Ranges
via Digitalmars-d
digitalmars-d at puremagic.com
Sun Aug 3 01:50:46 PDT 2014
On Sunday, 3 August 2014 at 06:19:12 UTC, Freddy wrote:
> On Friday, 1 August 2014 at 23:57:37 UTC, Freddy wrote:
>> I just curious, do Associative Ranges exist. If so where can i
>> find them. I started thinking about them when i asked this
>> question:
>> http://forum.dlang.org/thread/vauuognmhvtjrktazyeb@forum.dlang.org
> I started a phobos fork for this, what do you think so far
> https://github.com/Superstar64/phobos/blob/60d3472b1056b298319976f105aa3b9b3f165e97/std/range.d#L1357-1420
Nice!
A few comments after a cursory glance:
1) "aligns" sounds strange, use "corresponds" instead.
2) It would be preferable that associative ranges mimic built-in
associative arrays as closely as possible, i.e. the range members
should be called `byKey` and `byValue`, and it should allow
iteration over the associative range directly, instead of using
the `range` member.
3) For the value and key ranges, there should be a guarantee that
they can be zipped through, i.e. that the elements in them are in
the same order so keys and values correspond to each other. The
built-in associative arrays provide `byKey` and `byValue`, which
satisfy this condition.
More information about the Digitalmars-d
mailing list