the SKILL language has the functions subclassesOf and superclassesOf
which calculate the subclasses and superclasses. superclasses are given
from most specific to least specific.
How can i do this in common lisp?
-jim
Jim Newton wrote:
> the SKILL language has the functions subclassesOf and superclassesOf
> which calculate the subclasses and superclasses. superclasses are given
> from most specific to least specific.
>
> How can i do this in common lisp?
It varies between implementations because the so-called meta-object
protocol underlying CLOS did not make it into the spec.
AllegroCL offers class-direct-subclasses and class-direct-superclasses.
The class-precedence-list function (which did make it into the spec)
will let you figure out indirect superclasses by process of elimination.
MCL was similar, but there was one difference I encountered switching
between the two. Forget what.
btw, an overall pointer: I checked my recall on this in AllegroCL with
(apropos 'classes). apropos is great in situations like this where you
are pretty much at sea but can guess at part of the name a function (or
class or global var or any other symbol would have. Looks across all
packages as well.
kenny
--
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
Jim Newton wrote:
> the SKILL language has the functions subclassesOf and superclassesOf
> which calculate the subclasses and superclasses. superclasses are given
> from most specific to least specific.
>
> How can i do this in common lisp?
This depends on what you mean by "calculate". The CLOS MOP provides two
introspection fuctions called class-direct-superclasses and
class-direct-subclasses. You need to determine the transitive closure by
hand.
The function that actually determines the class precedence list is
compute-class-precedence-list. You can get it, once it's computed, via
class-precedence-list. It's also sorted from most specific to least
specific, according to the rules of the metaclass.
Pascal
--
Tyler: "How's that working out for you?"
Jack: "Great."
Tyler: "Keep it up, then."
in cmucl i see that both of these functions are undefined.
compute-class-precedence-list and class-precedence-list.
Pascal Costanza wrote:
>
> Jim Newton wrote:
>
>> the SKILL language has the functions subclassesOf and superclassesOf
>> which calculate the subclasses and superclasses. superclasses are given
>> from most specific to least specific.
>>
>> How can i do this in common lisp?
>
>
> This depends on what you mean by "calculate". The CLOS MOP provides two
> introspection fuctions called class-direct-superclasses and
> class-direct-subclasses. You need to determine the transitive closure by
> hand.
>
> The function that actually determines the class precedence list is
> compute-class-precedence-list. You can get it, once it's computed, via
> class-precedence-list. It's also sorted from most specific to least
> specific, according to the rules of the metaclass.
>
>
> Pascal
>
Jim Newton <·····@rdrop.com> writes:
> in cmucl i see that both of these functions are undefined.
> compute-class-precedence-list and class-precedence-list.
They should both be there, in CMUCL in the mop package, and in SBCL in
the sb-mop package.
From: Edi Weitz
Subject: Re: superclasses of and subclasses of
Date:
Message-ID: <uekk9j8bp.fsf@agharta.de>
On Fri, 08 Oct 2004 20:43:59 +0200, Jim Newton <·····@rdrop.com> wrote:
> in cmucl i see that both of these functions are undefined.
> compute-class-precedence-list and class-precedence-list.
···@miles:~$ cmucl
; Loading #p"/home/edi/.cmucl-init".
* (apropos "class-precedence-list")
PCL::EARLY-CLASS-PRECEDENCE-LIST [function] (class)
PCL:CLASS-PRECEDENCE-LIST [function]
PCL:COMPUTE-CLASS-PRECEDENCE-LIST [function]
KERNEL:STD-COMPUTE-CLASS-PRECEDENCE-LIST [function] (class)
Edi.
--
Lisp is not dead, it just smells funny.
Real email: (replace (subseq ·········@agharta.de" 5) "edi")