From: Joshua Taylor
Subject: behavior of pprint with circular lists in structures
Date: 
Message-ID: <1172175664.826393.75770@q2g2000cwa.googlegroups.com>
Hello all,

I've spent some time looking through the printer docs, and trying to
track down the
dependencies between the different *print-xxx* variables, and whether
or not I'm
going to need to specify a function for pretty printing a structure
whose slots may
have contain circular lists. The behaviors I actually observe in two
systems (CLISP
and LispWorks) are as follows:

In CLISP:

[1]> (setf *print-circle* t)
T
[2]> (print '#1=(1 2 3 . #1#))

#1=(1 2 3 . #1#)
#1=(1 2 3 . #1#)
[3]> (pprint '#1=(1 2 3 . #1#))

#1=(1 2 3 . #1#)

[4]> (defstruct foo l)
FOO
[5]> (print (make-foo :l '#1=(1 2 3 . #1#)))

#S(FOO :L #1=(1 2 3 . #1#))
#S(FOO :L #1=(1 2 3 . #1#))
[6]> (pprint (make-foo :l '#1=(1 2 3 . #1#)))

#S(FOO :L #1=(1 2 3 . #1#))



But in Lispworks: (LWM 4.4.5):

CL-USER 1 > (setf *print-circle* t)
T

CL-USER 2 > (print '#1=(1 2 3 . #1#))

#1=(1 2 3 . #1#)
#1=(1 2 3 . #1#)

CL-USER 3 > (pprint '#1=(1 2 3 . #1#))

#1=(1 2 3 . #1#)

CL-USER 4 > (defstruct foo l)
Foo

CL-USER 5 > (print (make-foo :l '#1=(1 2 3 . #1#)))

#S(Foo :L #1=(1 2 3 . #1#))
#S(Foo :L #1=(1 2 3 . #1#))

CL-USER 6 > (pprint (make-foo :l '#1=(1 2 3 . #1#)))

;; and then it hangs here until I break manually.


I'm having a hard time determining what the behavior
*should* be (if it's even specified). Any thoughts
(or links into the HyperSpec so I can read for myself
what I don't seem to be able to find)?

Thanks!
From: Pascal Bourguignon
Subject: Re: behavior of pprint with circular lists in structures
Date: 
Message-ID: <87ps7of64z.fsf@voyager.informatimago.com>
"Joshua Taylor" <···········@gmail.com> writes:
> But in Lispworks: (LWM 4.4.5):
>
> CL-USER 1 > (setf *print-circle* t)
> T
>
> CL-USER 2 > (print '#1=(1 2 3 . #1#))
>
> #1=(1 2 3 . #1#)
> #1=(1 2 3 . #1#)
>
> CL-USER 3 > (pprint '#1=(1 2 3 . #1#))
>
> #1=(1 2 3 . #1#)
>
> CL-USER 4 > (defstruct foo l)
> Foo
>
> CL-USER 5 > (print (make-foo :l '#1=(1 2 3 . #1#)))
>
> #S(Foo :L #1=(1 2 3 . #1#))
> #S(Foo :L #1=(1 2 3 . #1#))
>
> CL-USER 6 > (pprint (make-foo :l '#1=(1 2 3 . #1#)))
>
> ;; and then it hangs here until I break manually.
>
>
> I'm having a hard time determining what the behavior
> *should* be (if it's even specified). Any thoughts
> (or links into the HyperSpec so I can read for myself
> what I don't seem to be able to find)?

Sounds like a bug in Lispworks.  
AFAIK, pprint should respect *PRINT-CIRCLE* too.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
        Un chat errant
se soulage
        dans le jardin d'hiver
                                        Shiki