[racket] (check-equal? hash1 hash2) fails

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Aug 17 09:18:48 EDT 2013

Those are equal if they are both mutable or both immutable. Probably one is
mutable and the other isn't (this, unfortunately, doesn't show up in the
print outs). It is quite confusing, I agree.

> (equal? #hash((6 . 1) (4 . 1) (3 . 2) (2 . 2)) #hash((2 . 2) (3 . 2) (4 .
1) (6 . 1)))
#t

Robby



On Sat, Aug 17, 2013 at 8:13 AM, J G Cho <gcho at fundingmatters.com> wrote:

> FAILURE
> actual:     #hash((6 . 1) (4 . 1) (3 . 2) (2 . 2))
> expected:   #hash((2 . 2) (3 . 2) (4 . 1) (6 . 1))
> name:       check-equal?
>
> I tried alternative like
> (check-true (hash-equal? hash1 hash2))
>
>  but it turns out hash-equal? is not what I expected it to be.
>
> Other than writing a custom comparison, is there a handy way to compare 2
> #hash?
>
> jGc
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130817/371d8837/attachment.html>

Posted on the users mailing list.