digitalmars.D.learn - Docs for `Group` type
- Bahman Movaqar (7/7) Jul 11 2016 When using `chunkBy` (unary pred) the result is a list of tuples. Each
- Mike Parker (6/13) Jul 11 2016 The 'Group' type is an implementation detail -- a type used
- Bahman Movaqar (6/12) Jul 12 2016 Thanks. Now since I can't do `takeOne` on `Group`[1], exactly what kind
- Mike Parker (10/21) Jul 12 2016 When you downloaded DMD, you also received the source to Phobos,
- Bahman Movaqar (11/12) Jul 12 2016 Yes. I'm working on Stockman[1] a playground to learn D.
- Edwin van Leeuwen (3/12) Jul 12 2016 What does group.writeln; output? That should give you a good
- Bahman Movaqar (4/18) Jul 12 2016 That's a good trick to know. Thanks.
- ag0aep6g (3/8) Jul 12 2016 Do you also add the import of takeOne? takeOne is not a range primitive,...
- Bahman Movaqar (4/13) Jul 12 2016 Stupid me! Thanks :-)
When using `chunkBy` (unary pred) the result is a list of tuples. Each tuple holds a key and a `Group` which belong to that key. Where can I find the docs for this `Group` type (I have already tried searching library on dlang.org)? Thanks, -- Bahman
Jul 11 2016
On Tuesday, 12 July 2016 at 04:25:26 UTC, Bahman Movaqar wrote:When using `chunkBy` (unary pred) the result is a list of tuples. Each tuple holds a key and a `Group` which belong to that key. Where can I find the docs for this `Group` type (I have already tried searching library on dlang.org)? Thanks,The 'Group' type is an implementation detail -- a type used internally -- that you aren't supposed to care about. All you need to care about is that it's a range. The documentation for chunkBy [1] explains what the return type is. [1] https://dlang.org/phobos/std_algorithm_iteration.html#.chunkBy
Jul 11 2016
On 07/12/2016 11:06 AM, Mike Parker wrote:The 'Group' type is an implementation detail -- a type used internally -- that you aren't supposed to care about. All you need to care about is that it's a range. The documentation for chunkBy [1] explains what the return type is. [1] https://dlang.org/phobos/std_algorithm_iteration.html#.chunkByThanks. Now since I can't do `takeOne` on `Group`[1], exactly what kind of range is `Group`? [1] Error: no property 'takeOne' for type 'Group' -- Bahman
Jul 12 2016
On Tuesday, 12 July 2016 at 08:03:53 UTC, Bahman Movaqar wrote:On 07/12/2016 11:06 AM, Mike Parker wrote:When you downloaded DMD, you also received the source to Phobos, so you can see for yourself. The only Group type I see the chunkBy implementations is at [1] (the link to the github viewer probably won't point to the same place for long, but you should be looking in the the version of ChunkByImpl for forward ranges). It's a forward range. Do you have some sample code that shows the error? [1] https://github.com/dlang/phobos/blob/master/std/algorithm/iteration.d#L1608The 'Group' type is an implementation detail -- a type used internally -- that you aren't supposed to care about. All you need to care about is that it's a range. The documentation for chunkBy [1] explains what the return type is. [1] https://dlang.org/phobos/std_algorithm_iteration.html#.chunkByThanks. Now since I can't do `takeOne` on `Group`[1], exactly what kind of range is `Group`? [1] Error: no property 'takeOne' for type 'Group'
Jul 12 2016
On 07/12/2016 01:01 PM, Mike Parker wrote:Do you have some sample code that shows the error?Yes. I'm working on Stockman[1] a playground to learn D. In file `etl.d`, line 110 [2], if I change the line to auto refInvoice = group[1].takeOne(); the file will not compile. I have attached the compile error to this message. Thanks, -- Bahman [1] https://github.com/bahmanm/stockman-d [2] https://github.com/bahmanm/stockman-d/blob/master/source/etl.d#L110
Jul 12 2016
On Tuesday, 12 July 2016 at 11:40:48 UTC, Bahman Movaqar wrote:On 07/12/2016 01:01 PM, Mike Parker wrote:What does group.writeln; output? That should give you a good sense of what is going on.Do you have some sample code that shows the error?Yes. I'm working on Stockman[1] a playground to learn D. In file `etl.d`, line 110 [2], if I change the line to auto refInvoice = group[1].takeOne(); the file will not compile. I have attached the compile error to this message. Thanks,
Jul 12 2016
On 07/12/2016 04:21 PM, Edwin van Leeuwen wrote:On Tuesday, 12 July 2016 at 11:40:48 UTC, Bahman Movaqar wrote:That's a good trick to know. Thanks. -- BahmanOn 07/12/2016 01:01 PM, Mike Parker wrote:What does group.writeln; output? That should give you a good sense of what is going on.Do you have some sample code that shows the error?Yes. I'm working on Stockman[1] a playground to learn D. In file `etl.d`, line 110 [2], if I change the line to auto refInvoice = group[1].takeOne(); the file will not compile. I have attached the compile error to this message. Thanks,
Jul 12 2016
On 07/12/2016 01:40 PM, Bahman Movaqar wrote:Yes. I'm working on Stockman[1] a playground to learn D. In file `etl.d`, line 110 [2], if I change the line to auto refInvoice = group[1].takeOne(); the file will not compile. I have attached the compile error to this message.Do you also add the import of takeOne? takeOne is not a range primitive, but a function that works on ranges. Need to import it in order to use it.
Jul 12 2016
On 07/12/2016 04:23 PM, ag0aep6g wrote:On 07/12/2016 01:40 PM, Bahman Movaqar wrote:Stupid me! Thanks :-) -- BahmanYes. I'm working on Stockman[1] a playground to learn D. In file `etl.d`, line 110 [2], if I change the line to auto refInvoice = group[1].takeOne(); the file will not compile. I have attached the compile error to this message.Do you also add the import of takeOne? takeOne is not a range primitive, but a function that works on ranges. Need to import it in order to use it.
Jul 12 2016