According to CLHS, 
"~W provides automatic support for the detection of circularity and
sharing. If the value of *print-circle* is not nil and ~W is applied
to an argument that is a circular (or shared) reference, an
appropriate #n# marker is inserted in the output instead of printing
the argument."

If I try the following
(let ((a '(1 2 3)) (*print-circle* t)) (format t "~w ~w" a a))
=>
(1 2 3) (1 2 3)

I think this is wrong.  The argument is shared, and should be handled
as such.

Now, with 
(let ((a '(1 2 3)) (*print-circle* t)) (format t "~w" (list a a)))
=>
(#1=(1 2 3) #1#)

Obviously, this is better, when the argument has shared subcomponents.

So the question is, is the first result wrong?  If this is not the
case, then ignore the following.

Some random investigations of the code led me to OUTPUT-OBJECT, called
twice in the first example (once for each arguments), and each time
calling CHECK-FOR-CIRCULARITY in a "clean" state (a context with no
circularity detection yet).  The later function's docstring refers to
some WITH-CIRCULARITY-DETECTION, which I can't find in the code, but
sounds like it should have been used in FORMAT body, so that all
arguments would have been processed within a single circularity
detection context.  Now, I admit I got lost in the recursive CHECK-IT
calls (otherwise, I would have tried to write such a macro), so I
could be deeply wrong.

Regards
-- 
    Frederic Dumont           / /  (_)__  __ ____  __
[EMAIL PROTECTED]   / /__/ / _ \/ // /\ \/ /
    PGP key 0711F125        /____/_/_//_/____/ /_/\_\  forever!!!!!!!
Hi! I'm a .signature virus! Copy me into your ~/.signature to help me spread!

Reply via email to