[Openmcl-devel] How to get names of slots of a structure?

Kevin Rosenberg kevin at rosenberg.net
Sun Oct 20 15:26:06 PDT 2002

Hello, I'd like to find out how to get the names of slots in a
structure. I have the following function that I'd like to get
supported in OpenMCL:

(defun structure-slot-names (s-name)
  "Given a STRUCTURE-NAME, returns a list of the slots in the
  #+allegro (class-slot-names s-name)
  #+lispworks (structure:structure-class-slot-names
	       (find-class s-name))
  #+sbcl (mapcar #'sb-pcl::slot-definition-name
		  (sb-pcl:find-class s-name)))
  #+cmu (mapcar
	 (pcl:class-slots (pcl:find-class s-name)))
  (loop as
	s across
	 (slot-value (find-class s-name) 'clos::layout))
	collecting s)
  #-(or allegro lispworks cmu sbcl scl)
  (error "structure-slot-names is not defined on this platform")

       Kevin Rosenberg        |  .''`.  ** Debian GNU/Linux **
  http://b9.com/debian.html   | : :' :      The  universal
  GPG signed and encrypted    | `. `'      Operating System
     messages accepted.       |   `-    http://www.debian.org/

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list