Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,28 @@
import Data.List (inits, intercalate, transpose)
import qualified Data.Set as S
--------------- MINIMUM ABBREVIATION LENGTH --------------
minAbbrevnLength :: [String] -> Int
minAbbrevlnLength [] = 0
minAbbrevnLength xs =
length . head . S.toList . head $
dropWhile ((< n) . S.size) $
S.fromList
<$> transpose (inits <$> xs)
where
n = length xs
--------------------------- TEST -------------------------
main :: IO ()
main = do
s <- readFile "./weekDayNames.txt"
mapM_ putStrLn $
take 10 $
intercalate "\t"
. (<*>)
[ show . minAbbrevnLength . words,
id
]
. return
<$> lines s