为什么“让”添加换行符?(我可以摆脱它吗?)

Fun*_*eks 0 lisp common-lisp

在我的 shell 中,我正在尝试一些东西,并注意到并在我的let语句开头添加了换行符。

[86]> (setf A 5)
5
[87]> (let () (print 'hello) (print 'there) A )
       ;; this blank line right here
HELLO
THERE
5
Run Code Online (Sandbox Code Playgroud)

有没有删除额外的换行符?

Gav*_*ock 7

这不是let添加换行符 --- 它是print.

根据CLHS:“print 就像 prin1,只是对象的打印表示前面是换行符,后面是空格。”

可以使用prin1,而不是:

CL-USER> (let () (prin1 'hello) (print 'there) 5)
HELLO
THERE 
5
Run Code Online (Sandbox Code Playgroud)

或者你可以使用 format

CL-USER> (let () (format t "~a~%~a~%" 'hello 'there) 5)
HELLO
THERE
5
Run Code Online (Sandbox Code Playgroud)