From: David Gadbois
Subject: Re: printing structures
Date: 
Message-ID: <65f30a$5ms$1@news3.texas.net>
Sam Shteingold  <···········@cctrading.com> wrote:
>Suppose I have a structure 
>(defstruct (zz (:print-function print-zz)) (aa) (bb))
>I want to define print-zz so that it will print something pretty if
>*print-pretty* is non-nil and the #S thing otherwise.

I would let *PRINT-READABLY* control the decision about when to use
the #S notation and use CALL-NEXT-METHOD inside of PRINT-OBJECT to do
the work:

(defmethod print-object ((zz zz) stream)
  (if *print-readably*
      (call-next-method)
      (format stream "ZZ: ~a (aa); ~a (bb)" (zz-aa zz) (zz-bb zz))))

--David Gadbois