On 2020-01-15 16:34, mark via Digitalmars-d-learn wrote:
Is this as compact as it _reasonably_ can be?
How about this?
auto uniqueWords(string filename, uint wordsize) {
import std.algorithm, std.array, std.conv, std.functional, std.uni;
return File(filename).byLine
.map!(line => line.until!(not!isAlpha))
.filter!(word => word.count == wordsize)
.map!(word => word.to!string.toUpper)
.array
.sort
.uniq;
}
