I have a global list of symbols, CLOS objects, and a corresponding print-object
method defined that gives them succinct summaries. I'd like to provide the user with a show-all
method that loops over them and prints the same output that I get at the REPL, using print-object
. An earlier question suggested method-function
to look up the specific method and then funcall
it, but using closer-mop
isn't an option.
I can get a specific object to print in the loop, but not looping over the list, e.g.:
(defun show-all (&optional (stream *standard-output*))
"Print summaries for all objects in the current environment"
(dolist (o *master-list*)
(format t "~A~%" o) ; prints symbol name as text
(print-object foo::my-object *standard-output*) ;prints my-object using print-object, this is what I want
(print-object o *standard-output*))) ; same as format, prints symbol-name as text
Anyone have any ideas of what's going on here? If I can print a specific object in the environment using print-object
, I should be able to print all of them looping over the list of symbols.