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 ...@@ -2,6 +2,7 @@ import Types
import Debug import Debug
import Eval import Eval
import System.IO import System.IO
import ReadCSV
parse :: String -> Program parse :: String -> Program
parse = notImplemented parse = notImplemented
...@@ -34,10 +35,6 @@ evalFinal = evalFull [] ...@@ -34,10 +35,6 @@ evalFinal = evalFull []
showFinal :: Expr -> IO () showFinal :: Expr -> IO ()
showFinal = notImplemented showFinal = notImplemented
--------------------------------------------
-------------------------------------------- --------------------------------------------
loadInputFile :: SymbolName -> IO Expr loadInputFile :: SymbolName -> IO Expr
loadInputFile name = do loadInputFile name = do
...@@ -46,8 +43,12 @@ loadInputFile name = do ...@@ -46,8 +43,12 @@ loadInputFile name = do
return output return output
where 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]] stripTrailingWhitespace (x:xs) = x : stripTrailingWhitespace xs
readCSV = notImplemented stripTrailingWhitespace [] = []
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment