Sort Associative Array by Key

bachmeier no at spam.net
Tue Aug 27 20:35:16 UTC 2019


On Tuesday, 27 August 2019 at 20:14:21 UTC, Machine Code wrote:

> It isn't really hard:

It really is hard. foo.byPair.array.sort!((a, b) => a.key < 
b.key).map!(a => a.value); is a lot to digest for someone 
learning the language. There's a big difference between not being 
hard for someone that understands what each piece does and not 
being hard for someone new to D. At a minimum, it would help to 
write it

foo.byPair
  .array
  .sort!((a, b) => a.key < b.key)
  .map!(a => a.value);


More information about the Digitalmars-d-learn mailing list