DIP80: phobos additions

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 15 06:55:14 PDT 2015


On Monday, 15 June 2015 at 13:44:53 UTC, Dennis Ritchie wrote:
> On Monday, 15 June 2015 at 10:00:43 UTC, Ilya Yaroshenko wrote:
>> N-dimensional slices is ready for comments!
>
> It seems to me that the properties of the matrix require `row` 
> and `col` like this:
>
> import std.stdio, std.experimental.range.ndslice, std.range : 
> iota;
>
> void main() {
>
>     auto matrix = 100.iota.sliced(3, 4, 5);
> 	
>     writeln(matrix[0]);
>     // [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], 
> [15, 16, 17, 18, 19]]
>
>     // writeln(matrix[0].row); // 4
>     // writeln(matrix[0].col); // 5
> }
>
> P.S. I'm not exactly sure that these properties should work 
> exactly as in my code :)

try .length!0 and .length!1 or .shape[0] and .shape[1]


More information about the Digitalmars-d mailing list