Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -1,14 +1,14 @@
import std.stdio, std.algorithm, std.file, std.string;
void main() {
auto keys = cast(char[])"unixdict.txt".read;
import std.stdio, std.algorithm, std.file, std.string;
auto keys = "unixdict.txt".readText!(char[]);
immutable vals = keys.idup;
string[][string] anags;
foreach (w; keys.splitter) {
immutable k = cast(string)w.representation.sort().release;
anags[k] ~= vals[k.ptr-keys.ptr .. k.ptr-keys.ptr + k.length];
immutable k = w.representation.sort().release.assumeUTF;
anags[k] ~= vals[k.ptr - keys.ptr .. k.ptr - keys.ptr + k.length];
}
//immutable m = anags.byValue.max!q{ a.length };
//immutable m = anags.byValue.maxs!q{ a.length };
immutable m = anags.byValue.map!q{ a.length }.reduce!max;
writefln("%(%s\n%)", anags.byValue.filter!(ws => ws.length == m));
writefln("%(%-(%s %)\n%)", anags.byValue.filter!(ws => ws.length == m));
}