Re: Rotate array in writefln?

2018-04-19 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/18/18 3:15 AM, Simen Kjærås wrote: On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4]

Re: Rotate array in writefln?

2018-04-19 Thread Simen Kjærås via Digitalmars-d-learn
On Thursday, 19 April 2018 at 10:10:41 UTC, Chris Katko wrote: That makes sense why transpose wouldn't work for my arrays! So you're saying if I used [][] (dynamic array) that's a range of ranges, and it would work? Yup. Static arrays can't be ranges, since popFront must mutate the length,

Re: Rotate array in writefln?

2018-04-19 Thread Chris Katko via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 07:15:47 UTC, Simen Kjærås wrote: On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0

Re: Rotate array in writefln?

2018-04-18 Thread Simen Kjærås via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4] data; file.writeln(format("%(%-(%d

Re: Rotate array in writefln?

2018-04-18 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 18 April 2018 at 06:54:29 UTC, Chris Katko wrote: I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4] data; file.writeln(format("%(%-(%d

Rotate array in writefln?

2018-04-18 Thread Chris Katko via Digitalmars-d-learn
I need to rotate an array by 90 degrees, or have writefln figure that out. I need, say: 0 4 5 6 0 0 0 0 0 0 0 0 0 0 0 0 But it's outputting: 0 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 int [4][4] data; file.writeln(format("%(%-(%d %)\n%)", data));