Re: [Haskell-cafe] lexicographic order

2008-03-31 Thread Simeon Mattes
Chaddaï Fouché-2 wrote: 2008/3/30, Bulat Ziganshin [EMAIL PROTECTED]: although the last alternative, (Branch l r) = (Branch l' r') = l == l' r = r' || l = l' seems suspicious to me. isn't it the same as (Branch l r) = (Branch l' r') = l = l' Yes, it should be : (Branch l

Re: [Haskell-cafe] lexicographic order

2008-03-31 Thread Chaddaï Fouché
2008/3/31, Simeon Mattes [EMAIL PROTECTED]: 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

[Haskell-cafe] lexicographic order

2008-03-30 Thread Simeon Mattes
Hello everyone, I would like to ask something that I found in the ebook a Gentle Introduction to Haskell. http://haskell.org/tutorial/stdclasses.html#sect8.4 data Tree a = Leaf a | Branch (Tree a) (Tree a) instance (Ord a) = Ord (Tree a) where (Leaf _) = (Branch _) = True

Re: [Haskell-cafe] lexicographic order

2008-03-30 Thread Niklas Broberg
Although I have tried to make sense what lexicographic order means I haven't figured out. Maybe an example with a simple application of this would be helpful. To be honest I can't understand what the symbol = really means. = means less than or equal to. Normally, lexicograpic order is the

Re: [Haskell-cafe] lexicographic order

2008-03-30 Thread Bulat Ziganshin
Hello Simeon, Monday, March 31, 2008, 12:45:54 AM, you wrote: The latter specifies a lexicographic order: Constructors are ordered by the order of their appearance the data declaration, and the arguments of a constructor are compared from left to right. Although I have tried to make sense

Re[2]: [Haskell-cafe] lexicographic order

2008-03-30 Thread Bulat Ziganshin
Hello Bulat, Monday, March 31, 2008, 1:16:35 AM, you wrote: if you can compare chars and 'a' 'b', then *lists* of chars compared in lexicographic order will be aaa aab aab aba baa abb as it was mentioned by Niklas Broberg, the last sentence should be reversed: abb baa sorry for +1

Re: [Haskell-cafe] lexicographic order

2008-03-30 Thread Chaddaï Fouché
2008/3/30, Bulat Ziganshin [EMAIL PROTECTED]: although the last alternative, (Branch l r) = (Branch l' r') = l == l' r = r' || l = l' seems suspicious to me. isn't it the same as (Branch l r) = (Branch l' r') = l = l' Yes, it should be : (Branch l r) = (Branch l' r') = l l' ||