Chris:
I'm happy with it, but maybe there is a more concise
implementation?
This is a bit shorter and a bit better (writefln is not yet able
to format tuples nicely):
void main() {
import std.stdio: writeln;
import std.algorithm.sorting: multiSort;
import std.array: array;
Maybe something like bearophile's example should go into the
documentation of std.algorithm.sorting.multiSort. It's a common
enough thing in programming.
On Tuesday, 21 April 2015 at 11:46:24 UTC, bearophile wrote:
Chris:
I'm happy with it, but maybe there is a more concise
implementation?
This is a bit shorter and a bit better (writefln is not yet
able to format tuples nicely):
void main() {
import std.stdio: writeln;
import
The following works great. It sorts an AA by value:
1. by frequency of word
2. by alphabetic order (if two or more words have the same value)
import std.stdio : writefln;
import std.algorithm.sorting : multiSort;
void main() {
size_t[string] wcount = [
hamster:5,
zorro:80,