digitalmars.D - .byKeyValue should probably return a Tuple
- Yuxuan Shui (7/7) Feb 15 2017 for(k, v; aa) { ... } is better than:
- Seb (6/13) Feb 15 2017 There's byPair (http://dlang.org/phobos/std_array.html#byPair)
- Yuxuan Shui (4/21) Feb 15 2017 Thanks!
- H. S. Teoh via Digitalmars-d (6/30) Feb 15 2017 Please file a bug against dlang.org to request this doc update, so that
- Seb (3/25) Feb 16 2017 Or just do it yourself - it's not that difficult:
- H. S. Teoh via Digitalmars-d (8/32) Feb 17 2017 Well, I didn't have time to fix it then, and I almost forgot about it.
for(k, v; aa) { ... } is better than: for(o; aa) { auto k = o.key, v = o.value; ... } right? Are there any reason why .byKeyValue doesn't return a Tuple?
Feb 15 2017
On Wednesday, 15 February 2017 at 21:54:20 UTC, Yuxuan Shui wrote:for(k, v; aa) { ... } is better than: for(o; aa) { auto k = o.key, v = o.value; ... } right? Are there any reason why .byKeyValue doesn't return a Tuple?There's byPair (http://dlang.org/phobos/std_array.html#byPair) that as a library does exactly the following: ``` a.byKeyValue.map!(pair => tuple(pair.key, pair.value)) ```
Feb 15 2017
On Wednesday, 15 February 2017 at 22:02:01 UTC, Seb wrote:On Wednesday, 15 February 2017 at 21:54:20 UTC, Yuxuan Shui wrote:Thanks! It should be more visible though. Can we include it here: https://dlang.org/spec/hash-map.html ?for(k, v; aa) { ... } is better than: for(o; aa) { auto k = o.key, v = o.value; ... } right? Are there any reason why .byKeyValue doesn't return a Tuple?There's byPair (http://dlang.org/phobos/std_array.html#byPair) that as a library does exactly the following: ``` a.byKeyValue.map!(pair => tuple(pair.key, pair.value)) ```
Feb 15 2017
On Thu, Feb 16, 2017 at 05:02:41AM +0000, Yuxuan Shui via Digitalmars-d wrote:On Wednesday, 15 February 2017 at 22:02:01 UTC, Seb wrote:Please file a bug against dlang.org to request this doc update, so that people won't forget to do it. Thanks! T -- It's amazing how careful choice of punctuation can leave you hanging:On Wednesday, 15 February 2017 at 21:54:20 UTC, Yuxuan Shui wrote:Thanks! It should be more visible though. Can we include it here: https://dlang.org/spec/hash-map.html ?for(k, v; aa) { ... } is better than: for(o; aa) { auto k = o.key, v = o.value; ... } right? Are there any reason why .byKeyValue doesn't return a Tuple?There's byPair (http://dlang.org/phobos/std_array.html#byPair) that as a library does exactly the following: ``` a.byKeyValue.map!(pair => tuple(pair.key, pair.value)) ```
Feb 15 2017
On Thursday, 16 February 2017 at 05:20:32 UTC, H. S. Teoh wrote:On Thu, Feb 16, 2017 at 05:02:41AM +0000, Yuxuan Shui via Digitalmars-d wrote:Or just do it yourself - it's not that difficult: https://github.com/dlang/dlang.org/edit/master/spec/hash-map.ddOn Wednesday, 15 February 2017 at 22:02:01 UTC, Seb wrote:Please file a bug against dlang.org to request this doc update, so that people won't forget to do it. Thanks! TOn Wednesday, 15 February 2017 at 21:54:20 UTC, Yuxuan Shui wrote:Thanks! It should be more visible though. Can we include it here: https://dlang.org/spec/hash-map.html ?[...]There's byPair (http://dlang.org/phobos/std_array.html#byPair) that as a library does exactly the following: ``` a.byKeyValue.map!(pair => tuple(pair.key, pair.value)) ```
Feb 16 2017
On Thu, Feb 16, 2017 at 08:43:57AM +0000, Seb via Digitalmars-d wrote:On Thursday, 16 February 2017 at 05:20:32 UTC, H. S. Teoh wrote:[...]On Thu, Feb 16, 2017 at 05:02:41AM +0000, Yuxuan Shui via Digitalmars-d wrote:On Wednesday, 15 February 2017 at 22:02:01 UTC, Seb wrote:Well, I didn't have time to fix it then, and I almost forgot about it. But luckily I kept this thread alive in my mail reader, so here it is: https://github.com/dlang/dlang.org/pull/1573 T -- People say I'm indecisive, but I'm not sure about that. -- YHL, CONLANGOr just do it yourself - it's not that difficult: https://github.com/dlang/dlang.org/edit/master/spec/hash-map.ddPlease file a bug against dlang.org to request this doc update, so that people won't forget to do it. Thanks! TThere's byPair (http://dlang.org/phobos/std_array.html#byPair) that as a library does exactly the following: ``` a.byKeyValue.map!(pair => tuple(pair.key, pair.value)) ```Thanks! It should be more visible though. Can we include it here: https://dlang.org/spec/hash-map.html ?
Feb 17 2017