Subject: Re: Finding CLOS instances From: Erik Naggum <erik@naggum.no> Date: 1998/10/09 Newsgroups: comp.lang.lisp Message-ID: <3116943851349974@naggum.no> * "Bob Manjoney" <rjmct@acm.org> | 1) How does one find instances of a particular CLOS class for inspection? | I'm coming from Smalltalk, where the expression: | | someClass allInstances. | | would return a collection of all instances of someClass. Is there anything | comparable in CLOS? nothing in CLOS itself, but I needed this once, and discovered a function (present in Allegro CL 4.3, 4.3.1, and 5.0) that helps me get it: (defun list-all-instances (class) (loop with instances = (excl::get-objects 12) ; standard-instance for index from 1 to (svref instances 0) for instance = (svref instances index) when (typep instance class) collect instance)) (evaluate (print-type-counts) to learn that 12 is standard-instance.) hope this helps. #:Erik