add day3
This commit is contained in:
parent
00f7598bee
commit
d170aac4aa
5 changed files with 922 additions and 0 deletions
21
day3/app/Main.hs
Normal file
21
day3/app/Main.hs
Normal file
|
@ -0,0 +1,21 @@
|
|||
module Main where
|
||||
|
||||
import Data.Char (isDigit)
|
||||
import qualified Data.HashSet as HashSet
|
||||
import Data.List.Split (splitOn)
|
||||
|
||||
getSeparators :: String -> [Char]
|
||||
getSeparators = filter checkSeparator
|
||||
|
||||
checkSeparator :: Char -> Bool
|
||||
checkSeparator c = not (isDigit c) && (c /= '.')
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
content <- readFile "sample.txt"
|
||||
let fileContent = (concat . lines) content
|
||||
let symbols = (HashSet.fromList . getSeparators) fileContent
|
||||
let test = (filter (/= "") . splitOn ".") fileContent
|
||||
print symbols
|
||||
print test
|
||||
putStrLn "Hello, Haskell!"
|
Loading…
Add table
Add a link
Reference in a new issue