Textonyms: Difference between revisions
Content added Content deleted
Line 904: | Line 904: | ||
<lang haskell>{-# LANGUAGE TupleSections #-} |
<lang haskell>{-# LANGUAGE TupleSections #-} |
||
import Data.List (groupBy, sortBy, sortOn) |
import Data.List (groupBy, maximum, sortBy, sortOn) |
||
import qualified Data.Map as M |
import qualified Data.Map as M |
||
import Data.Maybe (mapMaybe) |
import Data.Maybe (mapMaybe) |
||
Line 938: | Line 938: | ||
justifyRight n c = (drop . length) <*> (replicate n c ++) |
justifyRight n c = (drop . length) <*> (replicate n c ++) |
||
firstColWidth :: [[(String, String)]] -> Int |
|||
⚫ | |||
--------------------------- TEST --------------------------- |
|||
main :: IO () |
main :: IO () |
||
main = do |
main = do |
||
Line 949: | Line 950: | ||
ambiguous = take 5 $ sortBy (flip (comparing length)) textonyms |
ambiguous = take 5 $ sortBy (flip (comparing length)) textonyms |
||
longer = take 5 $ sortBy (flip (comparing (length . fst . head))) textonyms |
longer = take 5 $ sortBy (flip (comparing (length . fst . head))) textonyms |
||
⚫ | |||
⚫ | |||
⚫ | |||
mapM_ putStrLn $ |
mapM_ putStrLn $ |
||
[ "There are " ++ |
[ "There are " ++ |