Hi,
Is it possible to somehow shorter turn to slice on D? Maybe you
can use tuples?
F#:
-
printfn %A xs.[4 .. 7, 4 .. 9]
-
D:
-
writeln([a[4][4 .. $], a[5][4 .. $], a[6][4 .. $], a[7][4 .. $]]);
-
F#:
-
let xs = Array2D.init 10 10 (fun x y - x * 10 + y)
printfn [4 .. 7, 6
On Tuesday, 14 April 2015 at 14:21:41 UTC, Dennis Ritchie wrote:
writefln([%([%(%s, %)]%|\n %)], [a[4][4 .. $], a[5][4 .. $],
a[6][4 .. $], a[7][4 .. $]]);
At least this can be done as
-
writefln([%([%(%s, %)]%|\n %)], a[4..8].map !(b = b[4 .. $]));
-
On 04/14/2015 07:21 AM, Dennis Ritchie wrote:
F#:
-
printfn %A xs.[4 .. 7, 4 .. 9]
-
D supports that syntax as well:
http://dlang.org/operatoroverloading.html#slice
I have a simple example here:
On Tuesday, 14 April 2015 at 15:16:10 UTC, Ivan Kazmenko wrote:
On Tuesday, 14 April 2015 at 14:21:41 UTC, Dennis Ritchie wrote:
writefln([%([%(%s, %)]%|\n %)], [a[4][4 .. $], a[5][4 ..
$], a[6][4 .. $], a[7][4 .. $]]);
At least this can be done as
-
writefln([%([%(%s, %)]%|\n %)],