DIP67: Associative Ranges

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 29 10:34:40 PDT 2014


On Wed, Oct 29, 2014 at 05:23:07PM +0000, Brad Anderson via Digitalmars-d wrote:
> On Wednesday, 29 October 2014 at 06:59:09 UTC, bearophile wrote:
> >This is very false. I have tons of cases where you only iterate on
> >values or keys. On the other hand I have suggested several times that
> >I'd like a byPairs (that yields keys-values tuple pairs).
> >
> 
> It happens to me too but it's very much a minority of uses. Having
> sets as well as maps would help replace some of these cases. Not all,
> of course.
> 
> >
> >>Doing byKey requires you to do a lookup to get the corresponding
> >>value which just takes up cycles unnecessarily.
> >
> >Usually people use a "AA.byKey.zip(AA.byValue)" that is not reliable.
> 
> Better than doing key lookups on every iteration but awfully ugly and
> should be unnecessary. byPairs sounds good.

I've submitted a PR for byPair before, but it was roadblocked by the
fact that people demand that it return std.typecons.Tuple, yet we're not
allowed to import Phobos in druntime. Other than this IMO nitpicky
issue, the code was already all ready to go many moons ago.


T

-- 
We are in class, we are supposed to be learning, we have a teacher... Is it too much that I expect him to teach me??? -- RL


More information about the Digitalmars-d mailing list