[Haskell-cafe] lexicographic order
chaddai.fouche at gmail.com
Mon Mar 31 07:52:38 EDT 2008
2008/3/31, Simeon Mattes <simeon.mattes at gmail.com>:
> why I should take as right
> (a,b) <= (a',b') iff (a < a' or (a == a' and b <= b'))
> and not
> (a,b) <= (a',b') iff (a <= a' or (a == a' and b <= b'))
> The latter seems more logical, doesn't it?
No, it doesn't, since in the latter (1,2) <= (1,1) because 1 <= 1
> Though I can't understand why both
> (Branch l r) <= (Branch l' r') = l < l' || l == l' && r <= r'
> (Branch l r) <= (Branch l' r') = l <= l' || l == l' && r <= r'
> give the same results
They don't, the second is a mistake, the first is the right one.
More information about the Haskell-Cafe