On Tue, Aug 3, 2010 at 4:03 PM, Jeronimo Pellegrini <j...@aleph0.info> wrote: > I was wondering how to get Chicken to print cyclic structures > using references to previous elements instead of looping, like > this, for example (this is what Gauche does on the REPL, and > what Guile's display implementation does): > > > a > #0=(1 . #0#) > > Is there some way to configure Chicken to do that? (I've searched > the wiki but found nothing)
If you're open to using a different method to do so, both the fmt and srfi-38 eggs provide such a means via fmt and write-with-shared-structure, respectively. #;1> (use fmt) ; loading /opt/chicken/lib/chicken/5/fmt.import.so ... ; loading /opt/chicken/lib/chicken/5/srfi-1.import.so ... ; loading /opt/chicken/lib/chicken/5/srfi-13.import.so ... ; loading /opt/chicken/lib/chicken/5/srfi-69.import.so ... ; loading /opt/chicken/lib/chicken/5/extras.import.so ... ; loading /opt/chicken/lib/chicken/5/fmt.so ... #;2> (define a (list 1 2)) #;3> (set-cdr! a a) #;4> (fmt #f a) "#0=(1 . #0#)" #;1> (use srfi-38) ; loading /opt/chicken/lib/chicken/5/srfi-38.import.so ... ; loading /opt/chicken/lib/chicken/5/extras.import.so ... ; loading /opt/chicken/lib/chicken/5/srfi-38.so ... #;2> (define a (list 1 2)) #;3> (set-cdr! a a) #;4> (write-with-shared-structure a) (newline) #=0(1 . #0#) -- Taylor C. Venable http://metasyntax.net/ _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users