From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA32760; Mon, 1 Dec 2003 18:48:10 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA00075 for ; Mon, 1 Dec 2003 18:48:09 +0100 (MET) Received: from mwinf0503.wanadoo.fr (smtp5.wanadoo.fr [193.252.22.26]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hB1Hm8r03658 for ; Mon, 1 Dec 2003 18:48:08 +0100 (MET) Received: from debian (ca-bordeaux-8-158.w80-8.abo.wanadoo.fr [80.8.80.158]) by mwinf0503.wanadoo.fr (SMTP Server) with ESMTP id 70DEB6800261 for ; Mon, 1 Dec 2003 18:48:08 +0100 (CET) Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 1AQs9Y-0001f4-00 for ; Mon, 01 Dec 2003 18:48:08 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Question References: <3FCB610E.932B363B@tni.fr> From: Remi Vanicat Mail-Copy-To: never Date: Mon, 01 Dec 2003 18:48:07 +0100 In-Reply-To: <3FCB610E.932B363B@tni.fr> (sebastien FURIC's message of "Mon, 01 Dec 2003 16:41:02 +0100") Message-ID: <87d6b84eg8.dlv@wanadoo.fr> User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 furic:01 furic:01 tni-valiosys:01 toto:01 toto:01 int:01 int:01 labri:01 u-bordeaux:01 writes:01 remi:01 remi:01 vanicat:01 vanicat:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "sebastien FURIC" 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