小编kos*_*sta的帖子

如何在Common Lisp中将列表打印为矩阵

我在Common Lisp工作,试图让Windows游戏扫雷.

我有一个列表,(1 1 1 2 2 2 3 3 3)并希望打印像矩阵

(1 1 1
2 2 2
3 3 3)
Run Code Online (Sandbox Code Playgroud)

怎么做?

编辑

我在开头

(format t "Input width:")
(setf width (read)) 
(format t "Input height:")
(setf height (read))    
(format t "How many mines:")
(setf brMina (read))

(defun matrica (i j)
  (cond ((= 0 i) '())
    (t  (append (vrsta j) (matrica  (1- i) j) ))))


(setf minefield (matrica width height))

(defun stampaj ()
      (format t "~%~a" minefield ))
Run Code Online (Sandbox Code Playgroud)

lisp common-lisp

6
推荐指数
1
解决办法
594
查看次数

标签 统计

common-lisp ×1

lisp ×1