Textonyms: Difference between revisions

m
→‎{{header|Haskell}}: generalised a little
m (→‎{{header|Haskell}}: generalised a little)
Line 919:
(head . show <$> [2 ..])
(words "abc def ghi jkl mno pqrs tuv wxyz")
 
ambigousAndLongerSamples :: Int
-> [[(String, String)]]
-> [[[(String, String)]]]
ambigousAndLongerSamples n textonyms =
[take 5n . flip sortBy textonyms] <*>
(flip . comparing <$> [length, digitCountlength . snd . head])
 
 
--------------------------- TEST ---------------------------
Line 940 ⟶ 948:
]
let [ambiguous, longer] = ambigousAndLongerSamples 5 textonyms
let digitCount = length . snd . head
[wa, wl] = maximum . mapfmap digitCount(length . snd . head) <$> [ambiguous, longer]
[ambiguous, longer] =
[take 5 . flip sortBy textonyms] <*>
(flip . comparing <$> [length, digitCount])
[wa, wl] = maximum . map digitCount <$> [ambiguous, longer]
mapM_ putStrLn $
"Five most ambiguous:" :
9,655

edits