[plt-scheme] printing shared structures

From: Prabhakar Ragde (plragde at uwaterloo.ca)
Date: Tue Jan 29 12:25:56 EST 2008

Robby Findler wrote:
 >> While we are on the subject, if I have two structures, each of which
 >> involves sharing but no cycles, and I evaluate (print-graph #t) and then
 >> print them, will they print identically iff they are equal? in the R6RS
 >> sense? --PR

> I think so, and I think that should also be true if there are cycles.
> In the case that there are no cycles, then you don't even need to turn
> on print-graph for that to be true, iiuc.

It's not iff, unless I misunderstand equal?.

(define a (cons 1 empty))
(define b (cons a a))

(define c (cons 1 empty))
(define d (cons 1 empty))
(define e (cons c d))

(display b)
(display e)

The two lines printed are identical in Pretty Big, but if I add 
(print-graph #t), they're not. --PR

Posted on the users mailing list.