On 05/07/2011 09:07 PM, Andrej M. wrote:
I want to turn this:
auto arr = [1, 1, 2, 3, 4, 4];
into this:
auto arr2 = [[1, 1], [2], [3], [4, 4]];
I want an array of arrays of the same elements. Lazy or not, I don't care.
I thought I could get away with this inside some while loop:
auto equals =
Andrej M.:
I want to turn this:
auto arr = [1, 1, 2, 3, 4, 4];
into this:
auto arr2 = [[1, 1], [2], [3], [4, 4]];
I want an array of arrays of the same elements. Lazy or not, I don't care.
Currently if you use group like this:
writeln(arr.group());
You get:
[Tuple!(int,uint)(1, 2),
Thanks, group seems to work fine too.
I want to turn this:
auto arr = [1, 1, 2, 3, 4, 4];
into this:
auto arr2 = [[1, 1], [2], [3], [4, 4]];
I want an array of arrays of the same elements. Lazy or not, I don't care.
I thought I could get away with this inside some while loop:
auto equals = array(filter!a == b(arr));
arr =