Textonyms: Difference between revisions

m
Line 904:
<lang haskell>{-# LANGUAGE TupleSections #-}
 
import Data.List (groupBy, maximum, sortBy, sortOn)
import qualified Data.Map as M
import Data.Maybe (mapMaybe)
Line 938:
justifyRight n c = (drop . length) <*> (replicate n c ++)
 
firstColWidth :: [[(String, String)]] -> Int
colWidth xsfirstColWidth = maximum $. map (length . fst . head) xs
 
--------------------------- TEST ---------------------------
main :: IO ()
main = do
Line 949 ⟶ 950:
ambiguous = take 5 $ sortBy (flip (comparing length)) textonyms
longer = take 5 $ sortBy (flip (comparing (length . fst . head))) textonyms
[wa, wl] = colWidthfirstColWidth <$> [ambiguous, longer]
colWidth xs = maximum $ map (length . fst . head) xs
[wa, wl] = colWidth <$> [ambiguous, longer]
mapM_ putStrLn $
[ "There are " ++
9,659

edits