1- emacs lisp格式不是Common Lisp格式。注意缺失的 參數!因此
(format "%d" 42) == (cl:format NIL "~D" 42)
2 - 你的循環做的唯一的事情是:
- to check that board is a vector with at least two slots. (aref
signals an error if the index is out of bound).
- to check that each of those two slots are lists (first signals an
error when passed a non list).
- to check that the first element of each each of those two slots
are numbers. (format signals an error when you pass a non number
for %d).
這就是全部。
你從未說過你想打印任何東西。
要打印的東西,你必須把它放在一個緩衝區,並使用 PS打印緩衝液:
(defun draw-board (board)
(with-temp-buffer
(loop for x below 2
for hex = (aref board x)
do (insert (format "%d " (first hex))))
(ps-print-buffer)))
謝謝,我與Common Lisp中的格式化功能誤會吧。 0_0 – louxiu
@wvxvw'loop'是一個宏,所以你只需要使用'(eval-when-compile'(require'cl))',並且如果你編譯的話沒有運行時間的損失。 –