I have a function
(defun read-as-list (filename)
(defparameter parlist(list nil) )
(let ((in (open filename :if-does-not-exist nil)))
(when in
(loop for line = (read-line in nil)
while line do
(defparameter mylist line)
(push mylist (cdr (last parlist)))
;(append parlist (list mylist))
;(print mylist)
;(format t "~a~%" line)
)
(close in)
)
)
(print parlist)
(return-from read-as-list parlist)
)
which simply takes a file name and reads it into a nested list and returns the list
I call it in the down function like:
(defun test_on_test_data ()
(print "....................................................")
(print "Testing ....")
(print "....................................................")
(let (con (read-as-list "document1.txt"))
(print con)
)
)
(test_on_test_data)
in the function test-on-test-data, con prints nil and it does not call the function read-as-list
instead of printing the content of the files as list it prints nil.
can someone please help me out on this.
test_on_test_datafunction you don't useletcorrectly! It should be(let ((conNOT(let (con.lettakes list definitions, not single one.