On Tuesday, 16 December 2014 at 17:47:18 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
also rename
byPair to something else in the process).
What about by Python's byItem() and items()?
On Tue, Dec 16, 2014 at 11:56:20AM -0500, Steven Schveighoffer via
Digitalmars-d-learn wrote:
> On 12/16/14 11:47 AM, "Nordlöw" wrote:
> >On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven Schveighoffer wrote:
> >>I can never ever see a reason to implement 2 different ways to
> >>traverse the el
On Tuesday, 16 December 2014 at 16:56:20 UTC, Steven
Schveighoffer wrote:
I can do PR for adding
https://github.com/nordlow/justd/blob/master/range_ex.d#L527
to Phobos.
Were should I put it/them?
I think to be clear, the PR I said I will pull is for the
documentation update. A doc change ha
On 12/16/14 11:47 AM, "Nordlöw" wrote:
On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven Schveighoffer wrote:
I can never ever see a reason to implement 2 different ways to
traverse the elements, just to piss off people?
If you make a PR that adds that to documentation, I will pull it if it
On Tuesday, 16 December 2014 at 16:08:09 UTC, Steven
Schveighoffer wrote:
I can never ever see a reason to implement 2 different ways to
traverse the elements, just to piss off people?
If you make a PR that adds that to documentation, I will pull
it if it makes you feel better. I don't think i
On Monday, 15 December 2014 at 23:21:44 UTC, bearophile wrote:
Nordlöw:
BTW: Why doesn't aa.byKey.map work?
It currently works.
Bye,
bearophile
My mistake. Now both are at
https://github.com/nordlow/justd/blob/master/range_ex.d#L527
On 12/16/14 10:33 AM, Tobias Pankrath wrote:
so it will be documented? that was the rhetorical question.
Does it need to be? I don't see a reason for anyone to go out of their
way to make the implementation inconsistent. Do you?
At least I would prefer not to rely on undefined behaviour. I
so it will be documented? that was the rhetorical question.
Does it need to be? I don't see a reason for anyone to go out
of their way to make the implementation inconsistent. Do you?
At least I would prefer not to rely on undefined behaviour. If we
ever do change the AA implementation in
Nordlöw:
BTW: Why doesn't aa.byKey.map work?
It currently works.
Bye,
bearophile
On Monday, 15 December 2014 at 22:58:43 UTC, Nordlöw wrote:
Tuple!(Key,Value)[] pairs(Key,Value)(Value[Key] aa);
a suitable contender for now?
I especially wonder about the mutability of parameter aa.
More specifically is
https://github.com/nordlow/justd/blob/master/range_ex.d#L545
ok?
On Monday, 15 December 2014 at 14:41:43 UTC, bearophile wrote:
Nordlöw:
Is there a combined property of AAs that combine keys and
values typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then
retrieved corresponding keys in the order sorted.
You can add
On Mon, 15 Dec 2014 21:32:23 +
Meta via Digitalmars-d-learn wrote:
> On Monday, 15 December 2014 at 18:55:13 UTC, bearophile wrote:
> >> Now this yields tuples:
> >> assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
> >
> > But I'd really like tuples as built-ins for D -.- This is a
> > work-
On Monday, 15 December 2014 at 18:55:13 UTC, bearophile wrote:
Now this yields tuples:
assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
But I'd really like tuples as built-ins for D -.- This is a
work-around that cements the ugly Phobos tuples in the
language... -.-
Bye,
bearophile
Kenji
On Mon, Dec 15, 2014 at 06:46:20PM +, bearophile via Digitalmars-d-learn
wrote:
> H. S. Teoh:
>
> >I implemented this before, but it got rejected because people
> >insisted that it must return a range of Tuple, but Tuple is defined
> >in Phobos and druntime can't have dependencies on Phobos.
Now this yields tuples:
assert(aa.byPair!Tuple.array == aa.pairs!Tuple);
But I'd really like tuples as built-ins for D -.- This is a
work-around that cements the ugly Phobos tuples in the
language... -.-
Bye,
bearophile
On Mon, 15 Dec 2014 13:47:58 -0500
Steven Schveighoffer via Digitalmars-d-learn
wrote:
> On 12/15/14 1:10 PM, ketmar via Digitalmars-d-learn wrote:
> > On Mon, 15 Dec 2014 13:01:10 -0500
> > Steven Schveighoffer via Digitalmars-d-learn
> > wrote:
> >
> >>> but i agree that this
> >>> requirement
One possible solution:
Another idea is to make "byPair" and "pairs" templates that by
default return 2-structs and use a Tuple on request (so you have
to import Phobos Tuple if you want them, so byPair doesn't depend
on Phobos and you can put in druntime):
int[string] aa;
assert(aa.byPair.a
On Mon, 15 Dec 2014 18:42:11 +
bearophile via Digitalmars-d-learn
wrote:
> ketmar:
>
> > the only way to get it into the specs is to write the useful
> > library that relies on that behavior and then scream "don't
> > break our code, it's regression!" then it eventually may be
> > turned to
On 12/15/14 1:10 PM, ketmar via Digitalmars-d-learn wrote:
On Mon, 15 Dec 2014 13:01:10 -0500
Steven Schveighoffer via Digitalmars-d-learn
wrote:
but i agree that this
requirement should be documented. and i bet it will not, 'cause this
will support principle of least astonishment, which is co
H. S. Teoh:
I implemented this before, but it got rejected because people
insisted
that it must return a range of Tuple, but Tuple is defined in
Phobos and
druntime can't have dependencies on Phobos. :-(
Maybe I'll take another shot at this, since this question keeps
coming up.
One possibl
ketmar:
the only way to get it into the specs is to write the useful
library that relies on that behavior and then scream "don't
break our code, it's regression!" then it eventually may be
turned to requirement and documented.
This is a bad idea.
Bye,
bearophile
On Mon, 15 Dec 2014 13:01:10 -0500
Steven Schveighoffer via Digitalmars-d-learn
wrote:
> > but i agree that this
> > requirement should be documented. and i bet it will not, 'cause this
> > will support principle of least astonishment, which is completely alien
> > for D.
>
> Really? You done fi
On Mon, Dec 15, 2014 at 02:27:52PM +, "Nordlöw" via Digitalmars-d-learn
wrote:
> Is there a combined property of AAs that combine keys and values
> typically
>
> .pairs()
>
> or
>
> .byPairs()
>
> I need to sort the elements of an AA by value and then retrieved
> corresponding keys in the
On 12/15/14 12:52 PM, ketmar via Digitalmars-d-learn wrote:
On Mon, 15 Dec 2014 17:37:13 +
Tobias Pankrath via Digitalmars-d-learn
wrote:
I think we should require byKeys and byValues to iterate the
elements in the same order. Than we can just zip them for the
pairwise iteration.
Would th
On Mon, 15 Dec 2014 17:37:13 +
Tobias Pankrath via Digitalmars-d-learn
wrote:
> I think we should require byKeys and byValues to iterate the
> elements in the same order. Than we can just zip them for the
> pairwise iteration.
>
> Would this impose a performance problem with the current
>
You can add an eager pairs() function to Phobos that returns an
array of tuples.
byPairs can't be done in object.d for the dependency from
tuples that aren't yet (and perhaps never) built-in in D, and
it can't be done in Phobos because it needs access to
unspecified runtime functions.
B
Nordlöw:
Is there a combined property of AAs that combine keys and
values typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then
retrieved corresponding keys in the order sorted.
You can add an eager pairs() function to Phobos that returns an
array of tu
Is there a combined property of AAs that combine keys and values
typically
.pairs()
or
.byPairs()
I need to sort the elements of an AA by value and then retrieved
corresponding keys in the order sorted.
28 matches
Mail list logo