[pro] conditioning on *print-readably*
![](https://secure.gravatar.com/avatar/f3826f09cda5af90d95b7df1268825b1.jpg?s=120&d=mm&r=g)
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
participants (2)
-
Nikodemus Siivola
-
Tamas K Papp