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

From: Marijn (hkBst at gentoo.org)
Date: Thu Jun 9 11:34:52 EDT 2011

-----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.

> #lang racket
> 
> ;;; link structure
> (struct _dl (left val right) #:mutable
>  #:property prop:custom-write
>  (lambda (dl p write?)
>    (let ((print (if write? write display)))
>      (display #\()
>      (let loop ((dl dl))
>        (print (_dl-val dl))
>        (let ((right (_dl-right dl)))
>          (if right (begin (display " ")(loop right))
>              (display #\)) )))))  )
> 
> (define (dlist a b c)
>  (shared ((middle (_dl left   b right))
>           (left   (_dl #false a middle))
>           (right  (_dl middle c #false)))
>   middle) )
> 
> (dlist 1 2 3)
> 
> (display (dlist 1 2 3))
> 
> 
> Outputs:
> 
> 
> (2 3)(2 3)(2 3)
> (2 3)(2 3)

Expected output (something more like):


'(2 3)
(2 3)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3w6BwACgkQp/VmCx0OL2yqqgCaAlFw2wR4dZ+Ew9aaP0p1e3xc
mV8An1IGqd1p++7YR8iTwEqUNSS3ujN1
=+HIb
-----END PGP SIGNATURE-----


Posted on the users mailing list.