I have a question about LISP Programming language
What I have to do is read a file and save data in the file.
To do this, I found the function like this and executed it.
(defun get-file (pathname)
(with-open-file (stream pathname)
(loop for line = (read-line stream nil)
while line
collect line)))
get-file("sample.txt")
This printed "unbound variable". Why did the error happened? (If I just defined the function and compiled, there was no error)
How do I write the pathname correctly? (My data file (sample.txt) is in the same directory of LISP code file.)
And where the data had saved?
And how I can divide them (because the file is read line by line, the data with seperate attributes should be save in same line)
file data are saved like this
name 23.0 22 123 33 //(one string and four numbers)
name2 23.5 11 156 42 //(one string and four numbers)
name3 21.7 15 167 55 //(one string and four numbers)
Please help me I'am awkward in LISP Language because I'm fully adapted in C Language :(
Thanks a lot!!
get-file("sample.txt")should be(get-file "sample.txt"). This is basic Lisp function calling syntax.