clueless wrote:

> Hi. I want to have a sorted result of map-function, that is (in
> pseudocode):
> 
> sorted(map!(fun)(arr))
> 
> How can I do that? I have tried something like:
> 
> auto s = map!(fun)(arr);
> //sort(s);
> //sort(s[]);
> //sort(s.dup);
> writeln(s);
> 
> but without success.
> 
> Thanks in advance.

Hi, I'm not sure if it is supposed to work or not. sort is inplace but map   
does not offer opIndexAssign which sort needs. You can circumvent it by 
creating an array of the map:

import std.array;

auto s = array(map!fun(arr));
sort(s);

Reply via email to