0

我将这个从 (Land of Lisp)in 中读取函数的示例锁定到我的 sbcl repl 中,并且在我输入响应之前它不会显示提示:“请输入您的姓名”。然后它显示响应。我知道这是错误的,给了什么?

(defun say-hello ()
    (princ "Please type your name:") (let ((name (read-line)))
             (princ "Nice to meet you, ")
             (princ name)))

我尝试了其他示例写入函数,并尝试了 write 而不是 princ。没运气

这是我repl的剪切和粘贴:

* (defun say-hello ()
(princ "Please type your name:") (let ((name (read-line)))
         (princ "Nice to meet you, ")
         (princ name)))
WARNING: redefining COMMON-LISP-USER::SAY-HELLO in DEFUN

SAY-HELLO
* (say-hello)
gregg
Please type your name:Nice to meet you, gregg
"gregg"
4

1 回答 1

3

您应该finish-output在 first 之后调用princ,以确保输出实际上已被刷新。

于 2018-02-02T00:03:43.640 回答