Re: array help.

2014-07-08 Thread NA via Digitalmars-d-learn
On Tuesday, 8 July 2014 at 18:40:37 UTC, bearophile wrote: NA: will not work and no I can't sort it. Why no sort? Thanks, It works as expected. As for the sort - wasn't thinking straight. Cheers, NA

Re: array help.

2014-07-08 Thread bearophile via Digitalmars-d-learn
NA: will not work and no I can't sort it. Why no sort? void main() { import std.algorithm: sort, SwapStrategy; import std.array: empty; int[][][][] a = [[[], [], [], [], [[0, 1], [0, 2]], [[0, 0], [0, 3]] ],

Re: array help.

2014-07-08 Thread Tobias Pankrath via Digitalmars-d-learn
will not work and no I can't sort it. Cheers. What are you trying to do? To reorder the elements of a sequence in a specified manner is called sorting, where I live.

Re: array help.

2014-07-08 Thread Tobias Pankrath via Digitalmars-d-learn
On Tuesday, 8 July 2014 at 18:26:20 UTC, bearophile wrote: Tobias Pankrath: Use std.algorithm.sort with a custom comparison function. It's a very nice example of learning algorithms and data fitting. I have shown an answer very fitted (perhaps over-fitted) on the given example. I had your

Re: array help.

2014-07-08 Thread NA via Digitalmars-d-learn
On Tuesday, 8 July 2014 at 18:16:55 UTC, bearophile wrote: NA: Any ideas welcome. Is this good enough? void main() { import std.algorithm: swap; int[][][][] a = [[[], [], [[0, 1], [0, 2]], [[0, 0], [0, 3]] ], [[], [],

Re: array help.

2014-07-08 Thread bearophile via Digitalmars-d-learn
Tobias Pankrath: Use std.algorithm.sort with a custom comparison function. It's a very nice example of learning algorithms and data fitting. I have shown an answer very fitted (perhaps over-fitted) on the given example. With just the given data there is no way to know how much general the p

Re: array help.

2014-07-08 Thread bearophile via Digitalmars-d-learn
NA: Any ideas welcome. Is this good enough? void main() { import std.algorithm: swap; int[][][][] a = [[[], [], [[0, 1], [0, 2]], [[0, 0], [0, 3]] ], [[], [], [[1, 1], [1, 2]], [[1, 0], [1, 3]]

Re: array help.

2014-07-08 Thread Tobias Pankrath via Digitalmars-d-learn
Any ideas welcome. NA Use std.algorithm.sort with a custom comparison function.