This may be a consequence of updating mutable state inside a set datastructure. I haven't tried yet, but non-cyclic uses of mutable boxes inside sets may have similar results.<br><br clear="all">Carl Eastlund<br><br><div class="gmail_quote">
On Tue, May 8, 2012 at 9:25 AM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Looks like a bug. Why don't you file a bug report?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On May 7, 2012, at 6:33 PM, Daniel King wrote:<br>
<br>
> Hi,<br>
><br>
> The following code snippet is a bit confusing to me. Sets with cyclic structure<br>
> are not equal? even though they meet my intuitive definition of equal. I'm<br>
> curious exactly where my intuition goes wrong.<br>
><br>
> I imagine the reason why Racket can conclude that the lists are equal is because<br>
> the ordering of the list provides a necessary level of disambiguation. With a<br>
> set, Racket cannot be certain which element should match between the two<br>
> data, and this means potentially following cycles forever? I'm not entirely<br>
> clear on my reasoning, but I think this must be related to the root cause.<br>
><br>
> Note in the following snippet the let* forms differ only in the data constructor<br>
> used: `set' in the first form and `list' in the second form.<br>
><br>
> racket@> (let* ((a-box (box #f))<br>
> (b-box (box #f))<br>
> (a (set 1 a-box))<br>
> (b (set 1 b-box)))<br>
> (set-box! a-box a)<br>
> (set-box! b-box b)<br>
> (displayln a)<br>
> (displayln b)<br>
> (equal? a b))<br>
> #0=#<set: 1 #&#0#><br>
> #0=#<set: 1 #&#0#><br>
> #f<br>
> racket@> (let* ((a-box (box #f))<br>
> (b-box (box #f))<br>
> (a (list 1 a-box))<br>
> (b (list 1 b-box)))<br>
> (set-box! a-box a)<br>
> (set-box! b-box b)<br>
> (displayln a)<br>
> (displayln b)<br>
> (equal? a b))<br>
> #0=(1 #&#0#)<br>
> #0=(1 #&#0#)<br>
> #t<br>
><br>
> P.S.<br>
><br>
> For future reference, is this more of users@ material or dev@ material?<br>
><br>
> --<br>
> Dan King<br>
> College of Computer and Information Science<br>
> Northeastern University<br>
> _________________________<br>
> Racket Developers list:<br>
> <a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
<br>
<br>
_________________________<br>
Racket Developers list:<br>
<a href="http://lists.racket-lang.org/dev" target="_blank">http://lists.racket-lang.org/dev</a><br>
</div></div></blockquote></div><br>