[pro] conditioning on *print-readably*

Tamas K Papp tkpapp at gmail.com
Tue Jun 7 15:25:15 UTC 2011


Hi,

I am working with some structures that have quite a few elements but for
most of the time are easier to interpret using a one-line summary.

I would like to achieve the following: when *print-readably*, have the
structure printed the usual way, eg #S(...).  Otherwise use my custom
unreadable summary.  Eg (simplified example code):

(defstruct foo
  a b)

(defmethod print-object ((foo foo) stream)
  (if *print-readably*
      (...what-to-do-here?...)                 ; ??
      (print-unreadable-object (foo stream :type t)
        (format stream "my way of printing foo with A=~A and B=~A"
                (foo-a foo) (foo-b foo)))))

but I don't know how to call CL's built-in way of printing the
structure readably in the IF clause above.

Tamas





More information about the pro mailing list