Beginners Problem reading from two files simultaneously
Beginners Problem reading from two files simultaneously
Hi:
I am a beginner and I am having trouble reading from two files simultaneously. I am trying to use the with-open-file macro to get the job done. Help appreciated
I am a beginner and I am having trouble reading from two files simultaneously. I am trying to use the with-open-file macro to get the job done. Help appreciated
Re: Beginners Problem reading from two files simultaneously
Here is my function that works for a single file.
(defun flist (s)
(with-open-file (input s)
(loop for line = (read-line input nil nil)
while line
collect line into lines
finally (return (values lines)))))
(defun flist (s)
(with-open-file (input s)
(loop for line = (read-line input nil nil)
while line
collect line into lines
finally (return (values lines)))))
Re: Beginners Problem reading from two files simultaneously
I don't understand what your problem is. You can just open two files at the same time by nesting the WITH-OPEN-FILE macro.
Re: Beginners Problem reading from two files simultaneously
The main issue that I have is I am trying to read from two different files, merge the contents and display the output. The function posted above helps me read from a file and display but I was wondering how could I use the same snippet (with some modification??) to get the job done.Ramarren wrote:I don't understand what your problem is. You can just open two files at the same time by nesting the WITH-OPEN-FILE macro.
Thank you.
Re: Beginners Problem reading from two files simultaneously
Are you beginner to Lisp or to programming in general? You did not write what is exactly stopping you from implementing what you want. If you do not understand the snippet you posted sufficiently to make the modifications I would suggest reading either Common Lisp: A Gentle Introduction to Symbolic Computation by David S. Touretzky or Practical Common Lisp, both of which will teach you more than what can be explained in a forum post at this level.
Re: Beginners Problem reading from two files simultaneously
Awesome!!! Thanks a lot for pointing me towards those invaluable online resources. Now I can teach myself and get into a proficiency level that I need.
Thank you.
Thank you.