The arrays he gave as an example had all At least one dimension equal to 0. So assocs would produce an empty list as far as I remember, so the three arrays would be considered to be equal indeed. It's a pity I can't check that right now, I'm on mobile...
On Mon, May 26, 2014 at 5:12 PM, Kevin Van Horn <kevin@ksvanhorn.com> wrote:
I'm looking on the Haskell 98 Report, and the definition of (==) for values of type Array a b looks wrong to me. Here is the definition given:a == a' = (assocs a == assocs a')But this fails to account for the array length in each dimension; hence, ifHave you tested this? assocs produces a list whose length depends on the array bounds; (==) on lists accounts for the length. What's left is the possibility of bounds mismatches, but in that case the index elements of the list of pairs produced by assocs will not match and they will compare unequal.--brandon s allbery kf8nh sine nomine associatesunix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners