lispcommon-lispsbclclosmop

Strange class precedence list in sbcl


In sbcl,

*(sb-mop:class-precedence-list (find-class 'cons))
==>(#<BUILT-IN-CLASS CONS> #<BUILT-IN-CLASS LIST> #<BUILT-IN-CLASS SEQUENCE>
 #<BUILT-IN-CLASS T>)

Isn't it strange that cons inherits from list and not the other way around? What am I missing here?


Solution

  • This is per the specification. A LIST is either a CONS, or a symbol NIL (which is the only object of type NULL), which means that both of those types are specializations of LIST, and hence their equivalent system classes inherit from LIST.