[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
  structure."
  #+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:class-slots
		  (sb-pcl:find-class s-name)))
  #+cmu (mapcar
	 #'pcl::slot-definition-name
	 (pcl:class-slots (pcl:find-class s-name)))
  #+scl
  (loop as
	s across
	(kernel::layout-slots
	 (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")
  )

Thanks!													    
-- 
       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
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list