Textonyms: Difference between revisions

m
→‎{{header|Haskell}}: Tidied (version using traverse with Data.Map)
m (→‎{{header|Haskell}}: Tidied (version using traverse with Data.Map))
Line 919:
(head . show <$> [2 ..])
(words "abc def ghi jkl mno pqrs tuv wxyz")
 
--------------------------- TEST ---------------------------
Line 929 ⟶ 928:
codeGroups = groupBy (on (==) snd) . sortOn snd $ encodings
textonyms = filter ((1 <) . length) codeGroups
[ambiguous, longer] = take 5 $ sortBy (flip (comparing length)) textonyms
longer = [take 5 $. sortBy (flip (comparingsortBy (lengthtextonyms] . snd . head))) textonyms<*>
((flip . comparing) <$> [length, length . snd . head])
[wa, wl] = maximum . map (length . snd . head) <$> [ambiguous, longer]
mapM_ putStrLn $
Line 945:
fmap (showTextonym wa) ambiguous ++
["", "5 longest:"] ++ fmap (showTextonym wl) longer
 
------------------------- DISPLAY --------------------------
9,655

edits