Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading file using Common Lisp

I need to read a text file using Common Lisp. File must be read to list of lists. Each list in the list must consist of a line from file. How to do this? I have done only this:

(let ((in (open "D:/Others/rgr.txt")))
  (format t "~a~%" (read-line in))
  (close in))
like image 271
pragmus Avatar asked Oct 27 '25 06:10

pragmus


1 Answers

(with-open-file (in file)
  (loop for line = (read-line in nil nil)
        while line
        collect (coerce line 'list)))
like image 102
Rainer Joswig Avatar answered Oct 30 '25 16:10

Rainer Joswig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!