You didn't put anything in the loop body. Your function reads a line ("foo"
), does nothing with it, then reads another line (nil
), your termination condition becomes true, and you print the null line.
Run this modified version to see what's happening:
(defun stringloop ()
(with-input-from-string (s "foo")
(do ((line (read-line s nil) ;; var init-form
(read-line s nil))) ;; step=form
((null line) (format t "termination condition - line: ~s~% " line))
(format t "in loop - line: ~s~%" line))))