[racket] Reading Graph Structure: read: #..= expressions not allowed in read-syntax mode (??)

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Thu Jun 9 11:38:05 EDT 2011

On Thu, Jun 9, 2011 at 8:34 AM, Marijn <hkBst at gentoo.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks Matthias,
>
> On 06/09/11 16:34, Matthias Felleisen wrote:
>>
>> (1) To create cyclic structs you need mutability in our world. [gensym is 0 assignments, cyclic structs is 1 assignment, and state is N assignments.]
>>
>> (2) I think the failure should come earlier when a struct isn't mutable. If you agree, you can try to request a feature change.
>
> I agree and would be happy if this behavior was changed.
>
> So any idea as to why my custom-write doesn't work correctly? AFAICT the
> code should work, so either I screwed up or misunderstood something or
> this is a bug.

You aren't printing to the provided port, but to stdout.  The printer
is called multiple times to detect cycles, leading to the behavior you
see. Providing `p' as the  port argument to `write' or `display'
should fix the problem.
-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.