Browse thread
[Caml-list] Question
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2003-12-01 (17:48) |
From: | Remi Vanicat <vanicat@l...> |
Subject: | Re: [Caml-list] Question |
"sebastien FURIC" <sebastien.furic@tni-valiosys.com> writes: > Hi, > > What do you think of the following code? > > # type toto = Toto of int | Titi of string;; > type toto = Toto of int | Titi of string > # let test t t' = match t, t' with > | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0 > -> "OK" > | _ -> "KO";; > Characters 73-79: > Warning: this pattern is unused. > | ((Toto _ | Titi _), Toto x | Toto x, (Toto _ | Titi _)) when x = 0 > -> "OK" > ^^^^^^ I can't answer to your question, but with your example, one can do a: # let test t t' = match t, t' with | ((Toto _ | Titi _), Toto 0 | Toto 0, (Toto _ | Titi _)) when x = 0 -> "OK" | _ -> "KO";; of course, this is not generalizable to any test. -- Rémi Vanicat ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners