Discussion:
conditioning on *print-readably*
Tamas K Papp
2011-06-07 15:25:15 UTC
Permalink
Content preview: 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): [...]

Content analysis details: (-2.3 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
0.0 FREEMAIL_FROM Sender email is freemail (tkpapp[at]gmail.com)
-2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium
trust
[80.91.229.12 listed in list.dnswl.org]
-0.0 SPF_HELO_PASS SPF: HELO matches SPF record
-0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
domain
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/417>

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
Nikodemus Siivola
2011-06-07 15:39:38 UTC
Permalink
but I don't know how to call CL's built-in way of printing the > structure
readably in the IF clause above. (call-next-method) [...]

Content analysis details: (-100.7 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
trust
[209.85.210.51 listed in list.dnswl.org]
-100 USER_IN_WHITELIST From: address is in the user's white-list
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/418>
but I don't know how to call CL's built-in way of printing the
structure readably in the IF clause above.
(call-next-method)

Cheers,

-- nikodemus

Loading...