From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id F25F3BC48 for ; Thu, 31 Mar 2005 16:34:49 +0200 (CEST) Received: from vapor.isi.edu (vapor.isi.edu [128.9.64.64]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2VEYm5v028600 for ; Thu, 31 Mar 2005 16:34:49 +0200 Received: from albini.isi.edu (albini.isi.edu [128.9.216.111]) by vapor.isi.edu (8.11.6p2+0917/8.11.2) with ESMTP id j2VEXss10444; Thu, 31 Mar 2005 06:33:54 -0800 (PST) Date: Thu, 31 Mar 2005 06:33:54 -0800 (PST) From: Hal Daume III To: Oliver Bandel Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] generic data type -> int function In-Reply-To: <20050330222944.GB443@first.in-berlin.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-ISI-4-38-10-MailScanner: Found to be clean X-MailScanner-From: hdaume@isi.edu X-Miltered: at concorde with ID 424C0A88.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 mtype:01 pairs:01 mtype:01 pairs:01 integers:01 nam:98 nam:98 ...:98 ...:98 int:01 int:01 data:02 maths:02 talks:02 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: > > type etype = GPE | LOC | ORG | PER | NAE_e | BOS_e > > type mtype = BAR | NAM | NOM | PRE | PRO | OTHER | NAE_m | BOS_m > > type pairs = EM of etype*mtype | EE of etype*etype | MM of mtype*mtype > > type pairs2 = EP of etype * pairs | MP of mtype * pairs > > > > > > Corresponding output: > > > > let int_of_etype = function | GPE -> 0 | LOC -> 1 | ORG -> 2 | PER -> 3 | NAE_e -> 4 | BOS_e -> 5 > > let int_of_mtype = function | BAR -> 0 | NAM -> 1 | NOM -> 2 | PRE -> 3 | PRO -> 4 | OTHER -> 5 | NAE_m -> 6 | BOS_m -> 7 > > > ...ooops... GPE as well as BAR has the same output-value... > ...so... if there is no problem with that kind of similar integers, > why don't you use Kims solution?! > Ut seemed to me that it has solved your problem, at least in this respect. Because it cannot handle the 'type pairs' or 'type pairs2' above. The enumerations are unique per type. -- Hal Daume III | hdaume@isi.edu "Arrest this man, he talks in maths." | www.isi.edu/~hdaume