我有一个循环:
(defun echo-lines ()
(loop while
(let ((line (read-line)))
(if (equal line "done")
nil
(print line)))))
我希望它在用户结束行后回显用户的输入,除非他们输入了“完成”,在这种情况下它会停止。相反,它第一次回显一个空行,之后,它回显前一个的输入。例子:
* (echo-lines)
Hello, loop.
This is my second line.
"Hello, loop."
This is my third.
"This is my second line."
I'm almost done.
"This is my third."
done
"I'm almost done."
NIL
预期的:
* (echo lines)
Hello, loop.
"Hello, loop."
done
NIL