在常见的lisp中,如何以便携方式检查对象的类型

Par*_*ife 9 lisp common-lisp

我想定义一个方法,专门用于具有无符号字节8元素的数组类型的对象.在sbcl中,当您(make-array x :element-type '(unsigned-byte 8))通过SB-KERNEL :: SIMPLE-ARRAY-UNSIGNED-BYTE-8实现对象类时.是否有一种独立于实现的方式专门研究无符号字节数组类型?

Ter*_*aug 11

使用sharpsign-dot在读取时插入实现依赖对象类:

(defmethod foo ((v #.(class-of (make-array 0 :element-type '(unsigned-byte 8)))))
  :unsigned-byte-8-array)
Run Code Online (Sandbox Code Playgroud)

所述sharpsign点读者宏评估形式的读出时间,在确定类的阵列构成.该方法将专门用于特定Common Lisp实现用于该数组的类.