[elephant-devel] Class Heirarchies and Queries

Leslie P. Polzer sky at viridian-project.de
Tue Sep 16 09:28:58 UTC 2008


> Section
> 2.10 of the manual mentions that you can "query a base class of type
> people to get subclass instances such as employee, manager,
> consultant, etc".
> I happen to need to do exactly that, but I can't actually find the
> appropriate section in the manual.

I don't know where that section is (if it exists at all),
but you can use something like (untested, haven't got the code
at hand):

(defun get-instances-by-class* (classname)
  (flatten
    (loop for c in (mop:class-direct-subclasses (find-class classname))
          collect (get-instances-by-class classname))))

Hope that helps!

I think an appropriate keyword arg (:include-sublasses-p t)
should be added to those functions.

Care to submit a patch for it sometime? :)
If not then I'll do it eventually.

  Leslie


-- 
LinkedIn Profile: http://www.linkedin.com/in/polzer
Xing Profile: https://www.xing.com/profile/LeslieP_Polzer
Blog: http://blog.viridian-project.de/




More information about the elephant-devel mailing list