Just where has this language gone wrong?

Christophe Travert travert at phare.normalesup.org
Thu Jul 19 07:38:32 PDT 2012


"Robik" , dans le message (digitalmars.D:172718), a écrit :
> On Thursday, 19 July 2012 at 14:21:47 UTC, Petr Janda wrote:
>> Hi,
> 
> Hi
> 
>> I'm an occasional lurker on the D forums just to see where the 
>> language is going,but I'm a little puzzled. In another thread I 
>> found this code
>>
>> auto r = [5, 3, 5, 6, 8].sort.uniq.map!(x => x.to!string);
> 
> Here's list what happens:
> 
>   1) Array gets sorted
>   2) Duplicate elements gets removed (only unique stay)
>   3) Then it get's maped by delegate. It converts numbers into 
> strings.
>      `r` variable will be ["3", "5", "6", "8"]

To be more precise, `r` variable is a lazy range, equivalent to this 
array. r.array would be this array.




More information about the Digitalmars-d mailing list