> > You want to avoid code size quadratic in the number of constructors. Which > is possible: > let cmp x y = match x, y with > A, A -> true > | A, _ | _, A -> false > | B, B -> true > | B, _ | _, B -> false With one twist though: if done that way for (type foo = A | B), the last (_, B) pattern is actually redundant. If you want to avoid getting a warning here, you should comment it out or remove it: let cmp x y = match x, y with | A, A -> true | A, _ | _, A -> false | B, B -> true | B, _ (*| _, B*) -> false That's the style I use. On Sat, Apr 30, 2011 at 3:43 PM, craff73@gmail.com wrote: > Hello, > > You want to avoid code size quadratic in the number of constructors. Which > is possible: > > let cmp x y = match x, y with > A, A -> true > | A, _ | _, A -> false > | B, B -> true > | B, _ | _, B -> false > ... > > Cheers > Christophe > > -- > Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. > >