Advertisement
logicmoo

Untitled

Jan 11th, 2018
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 1.10 KB | None | 0 0
  1.  
  2. (defun method-info (m)(list (METHOD-QUALIFIERS m)(MOP:METHOD-LAMBDA-LIST m)(MOP:METHOD-SPECIALIZERS m)(MOP:METHOD-FUNCTION m)))
  3. (defun print_whatnot (b)(let ((*package* (find-package :keyword)))(print b)))
  4. (defun print-trip (str a b)(unless (eq a b)(print_whatnot (list str a b))))
  5. (defun print-subclasses (root &optional pre-print) (let ((class (typecase root (class root) (symbol (find-class root)) (t (class-of root)))))
  6.   (dolist (item (mapcar #'MOP:slot-definition-name (MOP:class-direct-slots class)))(print-trip "slot" (class-name class) item))
  7.   (dolist (item (mapcar #'class-name (MOP:class-direct-superclasses class)))(print-trip "subclass" item  (class-name class)))
  8.   (print-trip "precedance" (class-name class) (mapcar #'class-name (cdr (MOP:class-precedence-list class))))
  9.   (when pre-print (print-trip "subclass"  (class-name pre-print) (class-name class)))
  10.   (dolist (item (mapcar #'method-info (MOP:class-direct-methods class)))  (print-trip "method"  (class-name class) item ))
  11.   (dolist (item (MOP:class-direct-subclasses class))
  12.   (print-subclasses item class))))
  13. (print-subclasses t)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement