Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!lucid.com!pab%glen-canyon-dam From: pab%glen-canyon-dam@lucid.com (Peter Benson) Newsgroups: comp.lang.clos Subject: (none) Message-ID: <9106271432.AA02252@glen-canyon-dam> Date: 27 Jun 91 14:32:05 GMT References: <21012@sdcc6.ucsd.edu> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Lines: 30 Date: 27 Jun 91 04:03:27 GMT Organization: UC San Diego -- 1991 "Wannabe Real College" finalist From: sboswell@sdcc13.ucsd.edu (....What Is?....) Sender: commonloops-request@cis.ohio-state.edu I'm having a similar problem. I wrote an AVL tree in Lisp a few months back using a 4-element list as my basic data structure (left, data, height, right). Now I'm trying to convert it to CLOS. I defined the methods with parameter specializers that make them take my avl-tree class, but I need to be able to have "no avl-tree", which I was implementing as "nil". But of course none of the avl-tree methods recognize the null stuff. Is factoring the only way to get my methods to recognize both avl-tree and null as valid instances of avl-tree? I tried (defclass avl-tree (null) blah blah blah) but it didn't help. If there is no really good solution to this, I'll be amazed, since out of the OOP paradigms I've seen so far, CLOS has been the best. Steve Boswell | This opinion is distributed in the hopes that it whatis@ucsd.edu | will be useful, but WITHOUT ANY WARRANTY... whatis@gnu.ai.mit.edu | You need to have methods for both avl-tree and null. I really doubt you want avl-tree to inherit the characteristics of NIL. The other possiblity is to have a null-avl-tree class to use instead of nil and then avl-tree can be a subclass of that. You still need different methods since the null-avl-tree has no slots.