2011-11-04 13 views
2

私はテキストファイルを読み込んでそれをシーケンスにして渡したいと思っています。それ、どうやったら出来るの?Common Lispのテキストファイルから連続して読む

これは私がこれまで持っているものです。

(with-open-file (stream "filename.txt") 
    (format t "~a~%" (read-line stream))) 

テキストファイルは、このようなものです:

Hello this is a sentence. 
Hello this is second sentence. 

答えて

3
(with-open-file (in "filename.txt") 
    (with-output-to-string (out) 
    (loop :for line := (read-line in nil) :while line :do 
     (write-line line out))))) 
関連する問題