After about a year and a half of Lisp study, I've been starting to feel comfortable about starting a small project. Perhaps I've been hasty... I am trying to convert a comma separated values file to a 2d array. I looked at other people's code and I can't understand why their code is so long just to parse a csv file. Perhaps my approach is naive, but this is what I did:
I also tried to substitute the quotation marks but it seems that Lisp doesn't understand this: #\"
(defvar *stream* (open "C:\\yada\\table.csv"))
(substitute #\space #\, (read-line *stream*))
;Sample result:
"2010-09-30 115.05 115.79 113.59 114.13 287106700 114.13"
I probably should use WITH-OPEN-FILE instead of OPEN, but I couldn't read the next line in the csv file. I know I don't have an iterative array making part yet, but I am stuck at reading the entire string separated by spaces. I used READ-FROM-STRING (and a few combination of its keywords), but it seems to stop at the first space:(read-from-string (substitute #\space #\, (read-line *stream*))
;Sample result:
|2010-09-27|
10
I understand the first element isn't really a number, but I forgot what those bars mean: |...| I also tried to substitute the quotation marks but it seems that Lisp doesn't understand this: #\"