CSVãã¡ã¤ã«ã§åè¡ã®å é ãè¦ã¦ãéè¤ããå¤ããã£ããåãåºãã¹ã¯ãªãã
æ¥åã§å¿ è¦ã«ãªã£ãã®ã§ãåå¼·ãã¦ãHaskellã§æ¸ãã¦ã¿ãã
import Data.List.Split main = do csv <- readFile "./foo.csv" print $ check $ dataList csv --åè¡ã®å é ããªã¹ãåãã dataList :: String -> [String] dataList csv = foldr (\x xs -> (head (splitOn "," x)) : xs) [] (lines csv) --ãªã¹ãå ã«éè¤ãããã¼ã¿ãããããã§ã㯠check :: [String] -> [String] check [] = [] check (x:xs) | elem x xs = x : (check xs) | otherwise = check xs
lines csv
è¡ãã¨ã«ãªã¹ãã«ããå¦çããã£ãããã ãã§æ¸ããã®ã«ã¡ãã£ã´ãæåããã
checkã¯å帰ã§æ¸ããããã©ãããå°ãèããã°é«éé¢æ°ä½¿ã£ã¦æ¸ãããã ãªã