RosettaCodeData/Task/Anagrams/Pointless/anagrams.pointless

15 lines
336 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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