Top Document: FAQ: Object-oriented Programming in Lisp 5/7 [Monthly posting] Previous Document: [5-4] How can I store data and CLOS instances (with possibly circular references) on disk so that they may be Next Document: [5-6] Free CLOS software. See reader questions & answers on this topic! - Help others by sharing your knowledge (defun class-slot-names (class-name) "Given a CLASS-NAME, returns a list of the slots in the class." (mapcar #'clos:slot-definition-name (clos:class-slots (find-class class-name)))) (defmethod class-slot-names ((instance standard-object)) "Given an INSTANCE, returns a list of the slots in the instance's class." (mapcar #'clos:slot-definition-name (clos:class-slots (class-of instance)))) You can use CLASS-DIRECT-SLOTS instead of CLASS-SLOTS if you don't want inherited slots. Note that these functions are from the meta-object protocol specified in the original X3J13 draft spec (document X3J13/88-003), and may not be supported by all Lisps. User Contributions:Top Document: FAQ: Object-oriented Programming in Lisp 5/7 [Monthly posting] Previous Document: [5-4] How can I store data and CLOS instances (with possibly circular references) on disk so that they may be Next Document: [5-6] Free CLOS software. Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: ai+lisp-faq@cs.cmu.edu
Last Update March 27 2014 @ 02:11 PM
|
Comment about this article, ask questions, or add new information about this topic: