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 GAA21241; Tue, 12 Aug 2003 06:25:24 +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 GAA15859 for ; Tue, 12 Aug 2003 06:25:23 +0200 (MET DST) Received: from mail2.tpgi.com.au (mail.tpgi.com.au [203.12.160.58]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h7C4PLf01919 for ; Tue, 12 Aug 2003 06:25:21 +0200 (MET DST) Received: from syd-ts22-2600-093.tpgi.com.au (syd-ts22-2600-093.tpgi.com.au [203.26.30.93]) by mail2.tpgi.com.au (8.12.9/8.12.9) with ESMTP id h7C4PFPD016574; Tue, 12 Aug 2003 14:25:17 +1000 Subject: Re: [Caml-list] tpyping question From: skaller Reply-To: skaller@ozemail.com.au To: Remi Vanicat Cc: caml-list@inria.fr In-Reply-To: <8765l4m30u.dlv@wanadoo.fr> 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> <8765l4m30u.dlv@wanadoo.fr> Content-Type: text/plain Message-Id: <1060662327.19617.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 12 Aug 2003 14:25:28 +1000 Content-Transfer-Encoding: 7bit X-Kaspersky-Antivirus: Passed X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ozemail:01 caml-list:01 unifying:01 compilers:01 int:01 writes:01 remi:01 vanicat:01 match:02 wrote:03 abstract:03 let:04 probably:05 define:05 i'd:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, 2003-08-12 at 05:02, Remi Vanicat wrote: > 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] I'd consider that if the relationship were strong enough to abstract into a named type, meaning, it applies to more than one or two switchings (match). Unfortunately, the nature of compilers seem to be that in each function the groupings are different. The reason for this is probably that if they were not, then you'd not *just* make a type unifying the two tags .. you'd just use a single tag :-) ------------------- 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