|
|
|
|
|
by tromp
538 days ago
|
|
> The Haskell solution requires more steps and theory. Really? The suggested Haskell solution is main = do
contents <- readFile "test.txt"
print . map readInt . words $ contents
which is no more complex than the Python code. The entire file contents is read as a String into content. words breaks it into a list of words, and readInt parses each word into an Int. Finally the list of ints is printed. |
|