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 UAA14868; Mon, 11 Aug 2003 20:59:15 +0200 (MET DST) 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 UAA08906 for ; Mon, 11 Aug 2003 20:59:14 +0200 (MET DST) Received: from mwinf0601.wanadoo.fr (smtp3.wanadoo.fr [193.252.22.25]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7BIxEf08296 for ; Mon, 11 Aug 2003 20:59:14 +0200 (MET DST) Received: from debian (ca-bordeaux-9-87.w80-8.abo.wanadoo.fr [80.8.81.87]) by mwinf0601.wanadoo.fr (SMTP Server) with ESMTP id DE13F340012B for ; Mon, 11 Aug 2003 20:59:13 +0200 (CEST) Received: from moi by debian with local (Exim 3.36 #1 (Debian)) id 19mHvl-0001Rf-00 for ; Mon, 11 Aug 2003 21:02:09 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] tpyping question References: <1060564412.7474.11.camel@localhost.localdomain> <200308102251.57305.oleg_trott@columbia.edu> <1060576786.9476.31.camel@localhost.localdomain> <3F37271A.60005@1969.ws> <1060625815.16392.8.camel@localhost.localdomain> From: Remi Vanicat Mail-Copy-To: never Date: Mon, 11 Aug 2003 21:02:09 +0200 In-Reply-To: <1060625815.16392.8.camel@localhost.localdomain> (skaller@ozemail.com.au's message of "12 Aug 2003 04:16:55 +1000") Message-ID: <8765l4m30u.dlv@wanadoo.fr> User-Agent: Gnus/5.090024 (Oort Gnus v0.24) 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 ozemail:01 handler:01 imho:01 int:01 dept-info:01 labri:01 u-bordeaux:01 writes:01 remi:01 vanicat:01 match:02 let:04 define:05 pattern:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk skaller writes: > In reality there are 20 tags, not just the 2 shown. > So I'd have to write: > > match x with > | ..... > | `A _ as y > | `B _ as y -> let (i,j) = match y with `A v->v | `B u -> (u,0) in ... > | ...... If `A (x,y) and `B x have a link (as it seem in your example) I would have define the type type aorB = [`A of int * int | `B of int] and then your code become : match x with | ..... | #aorB as y -> let (i,j) = match y with `A v->v | `B u -> (u,0) in ... | ...... by the way, you only need one as for the | `A ... | `B ... pattern there is only one as, not two . > > repeating the tags, In fact I do this sometimes, but it's also poor > style repeating the tags. So I have 2 choices of poor style: > repeat tags or delocalise handler, repeat tags is the best way IMHO (to avoid to correct the bugs in only one of the two branch). -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~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