RosettaCodeData/Task/Anagrams/Pointless/anagrams.pointless
2023-07-01 13:44:08 -04:00

14 lines
336 B
Text

output =
readFileLines("unixdict.txt")
|> reduce(logWord, {})
|> vals
|> getMax
|> printLines
logWord(dict, word) =
(dict with $[chars] = [word] ++ getDefault(dict, [], chars))
where chars = sort(word)
getMax(groups) =
groups |> filter(g => length(g) == maxLength)
where maxLength = groups |> map(length) |> maximum