Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test if a class is a subclass of another class in common lisp

How do I see if one CLOS class is a subclass of another CLOS class?

like image 867
krzysz00 Avatar asked Jun 03 '10 23:06

krzysz00


2 Answers

You can get the CLASS-NAME of a class.

A class has also a type of the same name.

SUBTYPEP tests if a type is a subtype of another type.

like image 161
Rainer Joswig Avatar answered Oct 14 '22 17:10

Rainer Joswig


closer-mop provides a subclassp predicate

CL-USER> (c2mop:subclassp (find-class 'condition) (find-class 'error))
NIL
CL-USER> (c2mop:subclassp  (find-class 'error) (find-class 'condition))
T
like image 27
PuercoPop Avatar answered Oct 14 '22 17:10

PuercoPop