digitalmars.D - [your code here]
- Saurabh Das (18/18) Jan 10 2016 The D code part on the front page has only 2 examples currently.
The D code part on the front page has only 2 examples currently. I thought we should add to that. As per the instructions, I'm posting one sample here for approval: // Find anagrams of words void main() { import std.stdio, std.algorithm; string[][string] anagram_info; File("/usr/share/dict/words") .byLine .each!(w => anagram_info[w.dup.sort.idup] ~= w.idup); stdin .byLine .map!(l => anagram_info.get(l.sort.idup, [])) .each!writeln; } PS: I'm new to writing idiomatic D, so there could be improvements to this example. Do point them out :)
Jan 10 2016