相关疑难解决方法(0)

Common Lisp case和引用元素

我在CL写了一个地牢爬虫游戏,我遇到了案例表格的问题.

两件事情:

  • Common Lisp抱怨道 Duplicate keyform QUOTE in CASE statement
  • (make-instance 'cl-rogue:tile tile-type 'wall) 应打印为"#",但无论我使用哪种图块类型,对象都会打印为"".

代码:

(in-package :cl-user)

(defpackage :cl-rogue
  (:use :common-lisp)
  (:export
    :*rows*
    :*cols*
    :*levels*
    :tile
    :tile-type
    :tile-contents
    :tile-hidden
    :tile-locked
    :tile-closed
    :main))

(in-package :cl-rogue)

(defparameter *cols* 80)
(defparameter *rows* 24)
(defparameter *levels* 26)
Run Code Online (Sandbox Code Playgroud)

班级:

(defclass tile ()
  ((tile-type
    :initarg :tile-type
    :accessor tile-type
    :initform 'floor
    :documentation "Type of tile")
    (tile-contents
      :initarg :tile-contents
      :accessor tile-contents
      :initform '()
      :documentation "Any items the tile holds")
    (tile-hidden
      :initarg :tile-hidden
      :accessor tile-hidden
      :initform nil
      :documentation …
Run Code Online (Sandbox Code Playgroud)

case common-lisp quote

3
推荐指数
1
解决办法
1489
查看次数

标签 统计

case ×1

common-lisp ×1

quote ×1