Code: Select all
(with-open-file (in txt)
(labels ((rec ()
(unless (equal 'end-of-file
(peek-char t in nil 'end-of-file))
(append
(cl-ppcre:split "\ " (read-line in))
(rec)))))
(rec)))
Here's my attempt at read-word anyway.
Code: Select all
(defun read-word (stream)
(let ((c (peek-char nil stream nil)))
(if (or (char= c #\Space)
(char= c #\Newline))
(string (read-char stream))
(concatenate 'string
(string (read-char stream))
(read-word stream)))))