[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there an example of a function that will
- To: Luke Hohmann <hohmann@csmil.umich.edu>
- Subject: Re: Is there an example of a function that will
- From: bill@cambridge.apple.com (Bill St. Clair)
- Date: Thu, 25 Jun 1992 14:05:42 -0500
- Cc: info-mcl
>return ALL subclasses of a given class, not just the direct subclasses?
>I am looking for a recursive version of class-direct-subclasses that will
>return all the classes in a list, and I'm (for the moment) too lazy to
>write such a beast.....
This is faster and conses less then Jonathan Pierce's example.
It's also less general.
(defun class-all-subclasses (class)
(labels ((foo (class res)
(unless (member class res)
(push class res)
(dolist (subclass (class-direct-subclasses class))
(setq res (foo subclass res))))
res))
(foo class nil)))