[racket] shared and immutable structures

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Feb 1 10:33:28 EST 2011

At Tue, 01 Feb 2011 10:14:57 -0500, David Van Horn wrote:
>  > (shared ([a (cons 1 a)])
>      a)
> #0='(1 . #0#)
> 
>  > (struct kons (first rest) #:transparent)
>  > (shared ([a (kons 1 a)])
>      a)
> (kons 1 #<undefined>)
> 
> Is there a way to get the kons structure to behave like cons?

No. The `shared' form can only create cycles with mutable structures.



Posted on the users mailing list.