reading file byLine

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Sep 6 14:07:29 PDT 2015


On Sunday, 6 September 2015 at 21:01:09 UTC, Namal wrote:
> On Sunday, 6 September 2015 at 20:39:27 UTC, deed wrote:
>> On Sunday, 6 September 2015 at 17:57:49 UTC, Namal wrote:
>>
>>> Yeah, I just checked, it is 2.066,  how can I install the new 
>>> version on ubuntu with sudo apt-get?
>>
>> sudo apt-get install dmd
>> will give you dmd v2.067.1. Don't know when it will be 
>> upgraded to 2.068 though.
>
> I used the software center to install the newest one. Now it 
> compiles but I have no clue how to use uniq properly. I just 
> tried
>
> uniq(sort(arr));
>
> and
>
> auto arr = sort(a).uniq!("a==b").array;
>
> but I don't get an array with unique elements.

That should be it though... Could you try this minimal complete 
test?

import std.stdio;
import std.algorithm;

void main(string[] args) {
     int[] arr = [1, 2, 4, 2, 3, 4, 1];
     arr.sort.uniq.writeln;
}

// [1, 2, 3, 4]


More information about the Digitalmars-d-learn mailing list