避免 Clozure lisp 中的回声(菜鸟)

Avoiding echos in Clozure lisp (noob)

我口齿不清,遇到了一个(我认为)不寻常的问题。我想创建很长的列表;即,类似于 (setf *mat* (make-list 1000000)),但没有 Nil 在屏幕上打印一百万次。

我想到的最好的是...

(let () (setf *mat* (make-list 1000000)) (length *mat*))

(或闭包末尾的其他一些简短但无用的函数)

...但我怀疑有更好的解决方案来避免这些双足打印输出。任何输入表示赞赏。顺便说一句,我在 Windows 7.

下使用 Clozure v1.10

通常最后会调用(values)

Common Lisp 有办法在打印机级别处理长输出:

Welcome to Clozure Common Lisp Version 1.9-dev-r15612M-trunk  (DarwinX8664)!
? *print-length*
NIL
? (setf *print-length* 100)
100
? (make-list 1000000)
(NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL
 NIL NIL NIL NIL ...)

*print-length*这里是控制它的变量

设置 *print-length* 的替代方法是在 repl 上使用 defparameter 而不是 setfdefparameter returns 符号而不是值:

(defparameter *mat* (make-list 10000))
-> *mat*