Improve code in Haskell solution for Problem 54
This commit is contained in:
parent
74d32924a7
commit
7a67ad0659
@ -211,9 +211,8 @@ playGame g
|
||||
in if xs > ys then 1 else -1
|
||||
|
||||
main = do
|
||||
withFile "p054_poker.txt" ReadMode (\handle -> do
|
||||
contents <- hGetContents handle
|
||||
let games = map readGame (lines contents)
|
||||
result = sum $ filter (==1) $ map playGame games
|
||||
putStrLn $ "Project Euler, Problem 54\n"
|
||||
++ "Answer: " ++ show result)
|
||||
contents <- readFile "p054_poker.txt"
|
||||
let games = map readGame (lines contents)
|
||||
result = sum $ filter (==1) $ map playGame games
|
||||
putStrLn $ "Project Euler, Problem 54\n"
|
||||
++ "Answer: " ++ show result
|
||||
|
Loading…
x
Reference in New Issue
Block a user