Is there a way to gather slot-definition-readers from all the inheritance tree?

此生再无相见时 提交于 2019-12-02 02:52:17
coredump

This "community wiki" answer is here to provide an implementation of this feature. What follows uses no destructive operation (NCONC, MAPCAN) since an implementation might return an internal list without copying it. MAPPEND is imported from alexandria, and MOP operations can be imported from closer-mop.

(defun all-direct-slots (class)
  (append (class-direct-slots class)
          (mappend #'all-direct-slots
                   (class-direct-superclasses class))))

(defun all-slot-readers (class)
  (mappend #'slot-definition-readers
           (all-direct-slots class)))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!