Anagrams: Difference between revisions

Content added Content deleted
(→‎{{header|J}}: less focus on preparing text, more focus on interesting logic)
(→‎{{header|Haskell}}: wouldn't it be easier to just keep track of the word rather than the index?)
Line 12: Line 12:
f <- readFile "./../Puzzels/Rosetta/unixdict.txt"
f <- readFile "./../Puzzels/Rosetta/unixdict.txt"
let words = lines f
let words = lines f
wix = groupBy (groupon fst) . sort $ zipWith ((,).sort) words [0..]
wix = groupBy (groupon fst) . sort $ zipWith ((,).sort) words words
mxl = foldl' ((.length).max) 0 wix
mxl = foldl' ((.length).max) 0 wix
print . map (map ((words!!).snd)) . filter ((==mxl).length) $ wix
print . map (map snd) . filter ((==mxl).length) $ wix


</pre>
</pre>

== {{header|J}} ==
== {{header|J}} ==