Michael A. Koerber writes:
 > 
 > I believe I once saw a thread here on this subject,
 > but I can't locate it.
 > 
 > Given a defstruct such as
 > 
 > (defstruct (sphere-vec (:conc-name nil) (:print-object print-sphere-vec))
 >    "SPHERE-VEC.  A STRUCTURE for spherical vectors"
 >    r
 >    theta
 >    phi)
 > 
 > I'd like to, sometimes, by-pass the :PRINT-OBJECT method.  I recall
 > some trick along the lines of
 > 
 > (let ((*my-pretty* nil))
 >     (print object))
 > 
 > that answered the mail...I just can't reconstruct the details.
 > Can anyone help?

You want to write the print-object method yourself:

  (defstruct (sphere-vec (:conc-name nil))
     "SPHERE-VEC.  A STRUCTURE for spherical vectors"
     r
     theta
     phi)

  (defvar *sphere-pretty* t)

  (defmethod print-object ((object spehere-vec) stream)
    (if *sphere-pretty*
        (print-sphere-vec object stream)
        (call-next-method)))

Reply via email to