On Sunday, 25 August 2019 at 17:01:23 UTC, a11e99z wrote:
On Sunday, 25 August 2019 at 16:54:33 UTC, Samir wrote:
Is there a way to output the values of an associative array
based on the lexicographic order of the keys?
For example, if foo = ["VXE":8, "BZP":5, "JLC":2], I'd like to
output something like:
5
2
8
auto foo = ["VXE":8, "BZP":5, "JLC":2];
foo.byPair.array.sort!"a[0]<b[0]".map!"a[1]".writeln;
I think normal lambdas are better than these string ones:
foo.byPair.array.sort!((a, b) => a[0] < b[0]).map!(a =>
a[1]).writeln;