CS计算机代考程序代写 — CPSC 312 2021 – Assignment 3 Q3 solution

— CPSC 312 2021 – Assignment 3 Q3 solution
— Copyright D. Poole, 2021. Do not redistrubute

— splitsep (==’,’) “3,5,” => [“3″,”5″,””]
splitsep sep [] = [[]]
splitsep sep (h:t)
| sep h = []: splitsep sep t
| otherwise = ((h:w):rest)
where w:rest = splitsep sep t

— Some example queries to try:
— splitsep even [1,3,4,5,7,9,8,8,55,45]
— splitsep (==’,’) “comma,separated,list,as,in,a,csv,file”
— splitsep (==’,’) “csv,,with,missing,elts,,,”
— splitsep (`elem` ” ,.?!”) “What? is this thing? … called Love.”

readcsv filename =
do
file <- readFile filename return [splitsep (==',') line| line <- splitsep (=='\n') file] -- try: -- readcsv "test.csv"