Re: Simple casting?

2019-11-27 Thread ixid via Digitalmars-d-learn
On Wednesday, 27 November 2019 at 14:40:56 UTC, Timon Gehr wrote: On 27.11.19 11:43, ixid wrote: On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: import std; void main(){     int[] x=[1,1,2,3,4,4];     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;     writeln(y); } This

Re: Simple casting?

2019-11-27 Thread Timon Gehr via Digitalmars-d-learn
On 27.11.19 11:43, ixid wrote: On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: import std; void main(){     int[] x=[1,1,2,3,4,4];     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array;     writeln(y); } This stuff is a nightmare for less experienced users like myself, I wish

Re: Simple casting?

2019-11-27 Thread ixid via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: import std; void main(){ int[] x=[1,1,2,3,4,4]; int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; writeln(y); } This stuff is a nightmare for less experienced users like myself, I wish there were a single function

Re: Simple casting?

2019-11-26 Thread Timon Gehr via Digitalmars-d-learn
On 26.11.19 23:08, Taylor R Hillegeist wrote: On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote:     int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; how did you know to do that? chunkBy with a binary predicate returns a range of ranges. So if I want an array of arrays I

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 23:29:12 UTC, Ali Çehreli wrote: On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: >> int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; > > > how did you know to do that? std.array.array pulls

Re: Simple casting?

2019-11-26 Thread Ali Çehreli via Digitalmars-d-learn
On 11/26/19 2:08 PM, Taylor R Hillegeist wrote:> On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: >> int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; > > > how did you know to do that? Ranges don't have elements. They either generate elements according to an algorithm,

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 16:33:06 UTC, Timon Gehr wrote: int[][] y=x.chunkBy!((a,b)=>a==b).map!array.array; how did you know to do that?

Re: Simple casting?

2019-11-26 Thread Timon Gehr via Digitalmars-d-learn
On 26.11.19 06:05, Taylor R Hillegeist wrote: I'm attempting to do a segment group. details: alias ProbePoint[3]=triple; triple[] irqSortedSet = UniqueTriples.keys     .sort!("a[1].irqid < b[1].irqid",SwapStrategy.stable)     .array; 83:triple[][] irqSortedSets =

Re: Simple casting?

2019-11-26 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 06:45:19 UTC, Alex wrote: On Tuesday, 26 November 2019 at 05:17:54 UTC, Taylor R Hillegeist wrote: [...] What exactly is the problem, as this works for me if I understood your goal correctly: ´´´ void main() { import std.algorithm.comparison : equal;

Re: Simple casting?

2019-11-25 Thread Alex via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 05:17:54 UTC, Taylor R Hillegeist wrote: On Tuesday, 26 November 2019 at 05:05:48 UTC, Taylor R Hillegeist wrote: I'm attempting to do a segment group. details: alias ProbePoint[3]=triple; triple[] irqSortedSet = UniqueTriples.keys

Re: Simple casting?

2019-11-25 Thread Taylor R Hillegeist via Digitalmars-d-learn
On Tuesday, 26 November 2019 at 05:05:48 UTC, Taylor R Hillegeist wrote: I'm attempting to do a segment group. details: alias ProbePoint[3]=triple; triple[] irqSortedSet = UniqueTriples.keys .sort!("a[1].irqid < b[1].irqid",SwapStrategy.stable)