Hi,

> I have tested it in GHC 6.10.4 (Win XP) and GHC 6.8.3 (Linux), both give the 
> wrong result (categaried):
> 
>         7 <= 3 ?: False
>         3 <= 5 ?: True
>         3 <= 9 ?: True
>         3 <= 6 ?: True
>         3 <= 8 ?: True
>         3 <= 3 ?: True
>         3 <= 5 ?: True
>         3 <= 4 ?: True
> [[7],[3,5,9,6,8,3,5,4]]
What exactly is wrong with this result? All of the above comparisons seem to
get the right result, and they say 7 is not in the same categorie as 3, but
all other numbers are in the same category as 3. So the returned list looks ok
too.

Perhaps you had expected another output list (please tell us what you think
you've found a bug!)? In fact, it seems that any output list would have been
correct, since you're using a comparison function that is not symmetrical.

In other words, you're say 7 should be in the same category as 3, but 3 should
not be in the same category as 7. Since nothing is guaranteed about the order
in which groupBy compares elements, any grouping could be achieved by letting
groupBy choose the "right" ordering.

So, it seems your comparison function is wrong since it does not satisfy the
(unwritten) requirement of symmetry?

Gr.

Matthijs

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to