如何避免在最后打印的零? [英] How can I avoid the nil printed in the end?
本文介绍了如何避免在最后打印的零?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有codeD此功能,打印出董事会的状态,但在年底,由于这样的事实,心不是没有回报功能打印一个零!
I have coded this function that prints-out the state of the board, but in the end, due to the fact that there isnt no return the function prints an nil!
功能:
(defun show-board (board)
(dotimes (number 8)
(dotimes (number2 8)
(let ((pos (aref board number number2)))
(cond
((equal pos 0) (format t "~a " "B"))
((equal pos 1) (format t "~a " "P"))
(t (format t "~a " "L")))))
(format t "~%")))
一个板是一个8x8的阵列!
A board is an 8x8 array!
在命令行函数调用的输出:
function call output on command lines:
B P B P B P B P
P B P B P B P B
B P B P B P B P
P B P B P B P B
B P B P B P B P
P B P B P B P B
B P B P B P B P
P B P B P B P B
NIL
我怎样才能摆脱NIL的??
How can i get rid of the NIL??
推荐答案
添加(值)
作为回报形式 dotimes
将做到这一点:
adding (values)
as return form for dotimes
will do it:
(dotimes (number 8 (values))
.....)
毕竟显示板
确实不返回任何值吧?
这篇关于如何避免在最后打印的零?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文