User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:class-of [2019/09/14 05:00]
cl:functions:class-of [2019/09/22 06:00] (current)
Line 1: Line 1:
 +====== Function CLASS-OF ======
 +
 +====Syntax====
 +  * **class-of** //object// → //class//
 +
 +====Arguments and Values====
 +  * //object// - an //​[[CL:​Glossary:​object]]//​.
 +  * //class// - a //​[[CL:​Glossary:​class]]//​ //​[[CL:​Glossary:​object]]//​.
 +
 +====Description====
 +Returns the //​[[CL:​Glossary:​class]]//​ of which the //object// is a //​[[CL:​Glossary:​direct instance]]//​.
 +
 +====Examples====
 +<​blockquote>​
 +(class-of 'fred) <​r>#<​BUILT-IN-CLASS SYMBOL 610327300></​r>​
 +(class-of 2/3) <​r>#<​BUILT-IN-CLASS RATIO 610326642></​r>​
 +(defclass book () ()) <​r>#<​STANDARD-CLASS BOOK 33424745></​r>​
 +(class-of (make-instance '​book)) <​r>#<​STANDARD-CLASS BOOK 33424745></​r>​
 +(defclass novel (book) ()) <​r>#<​STANDARD-CLASS NOVEL 33424764></​r>​
 +(class-of (make-instance '​novel)) <​r>#<​STANDARD-CLASS NOVEL 33424764></​r>​
 +(defstruct kons kar kdr) <​r>​KONS</​r>​
 +(class-of (make-kons :kar 3 :kdr 4)) <​r>#<​STRUCTURE-CLASS KONS 250020317></​r>​
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +None.
 +
 +====See Also====
 +  * **[[CL:​Functions:​make-instance|Generic Function MAKE-INSTANCE]]**
 +  * **[[CL:​Functions:​type-of|Function TYPE-OF]]**
 +
 +====Notes====
 +None.
 +