chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Printing recursive objects


From: Jason Felice
Subject: Re: [Chicken-users] Printing recursive objects
Date: Wed, 24 Sep 2014 17:18:47 -0400

guile knows how to handle this:

scheme@(guile-user)> (define v (vector 0))

scheme@(guile-user)> (vector-set! v 0 v)

scheme@(guile-user)> v

$2 = #(#0#)


It can even read the self-referencing syntax, IIRC.

I know there's discussion of using Tortoise and Hare to break cycles in this situation, but what guile does seems more sophisticated.


On Wed, Sep 24, 2014 at 5:34 PM, Richard <address@hidden> wrote:
Hello Chickens,

If I have an object that references itself, like for example...

(define v (vector 0))
(vector-set! v 0 v)

and I print it, chicken goes -understandably- into an infinite loop.

Is there a way to prevent this, or is there something like
define-record-printer for non-record objects.

thank you,
Richard

_______________________________________________
Chicken-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/chicken-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]