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

From: J G Cho (gcho at fundingmatters.com)
Date: Sat Aug 17 09:27:08 EDT 2013

You were right on.

So I converted one of the mutable and it worked:
(make-immutable-hash  (hash->list mutable-hash))

Is there a better way?


On Sat, Aug 17, 2013 at 9:18 AM, Robby Findler
<robby at eecs.northwestern.edu>wrote:

> 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/ecd43d2b/attachment.html>

Posted on the users mailing list.