Skip to content
Snippets Groups Projects
Commit 4ffbb4a8 authored by pm3g19's avatar pm3g19
Browse files

Implemented stripping of csv strings

parent 2d4d5e50
No related branches found
No related tags found
No related merge requests found
......@@ -2,6 +2,7 @@ import Types
import Debug
import Eval
import System.IO
import ReadCSV
parse :: String -> Program
parse = notImplemented
......@@ -34,10 +35,6 @@ evalFinal = evalFull []
showFinal :: Expr -> IO ()
showFinal = notImplemented
--------------------------------------------
--------------------------------------------
loadInputFile :: SymbolName -> IO Expr
loadInputFile name = do
......@@ -46,8 +43,12 @@ loadInputFile name = do
return output
where
toRecord stringList = Record $ map String stringList
toRecord stringList = Record $ map ((String).stripLeadingAndTrailingWhitespace) stringList
stripLeadingAndTrailingWhitespace = stripTrailingWhitespace.dropWhile (==' ')
stripTrailingWhitespace (' ':xs) = let remainder = stripTrailingWhitespace xs in
if null remainder then [] else ' ':remainder
readCSV :: FilePath -> IO [[String]]
readCSV = notImplemented
\ No newline at end of file
stripTrailingWhitespace (x:xs) = x : stripTrailingWhitespace xs
stripTrailingWhitespace [] = []
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment