Filter and sort associative array

Alex sascha.orlov at gmail.com
Fri Jan 11 16:06:48 UTC 2019


On Friday, 11 January 2019 at 16:02:27 UTC, Head Scratcher wrote:
> Thank you. This works great. What I don't understand is how a 
> key-value pair ends up being a set of strings. Where did the 
> value of the key-value pair get removed?  According to the 
> library documentation, the array function "allocates an array 
> and initializes it with copies of the elements of range r." So 
> wouldn't the resulting array contain pairs? And if so, how does 
> the sort work on pairs?

By map you map the pair to its key resp. its first element. The 
result of the map contains the right-hand side of the "=>" 
expression only.


More information about the Digitalmars-d-learn mailing list