From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 2A16BBC48 for ; Tue, 19 Apr 2005 09:12:21 +0200 (CEST) Received: from irsun282.ifp.fr (ns1.ifp.fr [213.223.50.141]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j3J7CKbY003949 for ; Tue, 19 Apr 2005 09:12:21 +0200 Received: from smtp.ifp.fr by irsun282.ifp.fr (V35.12) with ESMTP Received: from irnts70 ([156.118.220.36]) by irnts70 with Microsoft SMTPSVC(5.0.2195.6713); Tue, 19 Apr 2005 09:15:22 +0200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Received: From irsun165.ifp.fr ([156.118.22.211]) by irnts70 (WebShield SMTP v4.5 MR1a P0803.345); id 1113894916750; Tue, 19 Apr 2005 09:15:16 +0200 Received: from [156.118.21.21] (irlin234 [156.118.21.21]) by irsun165.ifp.fr (8.8.5/8.8.5) with ESMTP id JAA20666 for ; Tue, 19 Apr 2005 09:12:14 +0200 (MET DST) Message-ID: <4264AF4D.8080308@ifp.fr> Date: Tue, 19 Apr 2005 09:12:13 +0200 From: Christophe DEHLINGER User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] type of == - Bayesian Filter detected spam References: <42637B63.1070608@ifp.fr> <200504181227.07108.jon@ffconsultancy.com> <001901c5440f$ce1a5e80$14b2a8c0@wiko> <200504181528.29618.jon@ffconsultancy.com> In-Reply-To: <200504181528.29618.jon@ffconsultancy.com> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable X-OriginalArrivalTime: 19 Apr 2005 07:15:22.0875 (UTC) FILETIME=[8D31E4B0:01C544AF] X-Miltered: at nez-perce with ID 4264AF54.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 christophe:01 caml-list:01 ocaml-only:01 bool:01 alas:01 ocaml-only:01 mutable:01 mutable:01 bool:01 eventuelles:01 autorisation:01 ...:98 ...:98 confidentiel:98 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: Jon Harrop wrote: >Assuming this is for an OCaml-only program, it sounds as though the = "other"=20 >possible types 'a and 'b should be put into a single variant type. Then = you=20 >can use "'a -> 'a -> bool" with "'a =3D your variant type". Does that = make any=20 >sense? :-) > > =20 > Alas, this does not work for me. This is for an OCaml-only module, in=20 which the "other" types are all instances of one polymorphic mutable=20 record type, but the number or exact values of these instances are not=20 known within the module and may be pretty much anything. Fortunately, I have an easy workaround in my case, but it can't really=20 be generalized. The polymorphic record type contains a "node" field=20 (which is a non-polymorphic mutable record). I know that two records=20 cannot share the same physical node, so I basically use the node as a=20 unique identifier for the records: type ('a, 'b) my_record_type =3D { ... ; node : node_type ; ... } let my_eq : ('a, 'b) my_record_type -> ('c,'d) my_record_type -> bool = =3D fun x y -> x.node =3D=3D y.node Obviously, this method only works if you have such a unique identifier=20 for every object you have to compare. If this node field hadn't been=20 there, I would have been stuck with either cheating with the Obj module, = or artificially adding a unique identifier to each record (like an int=20 or a unit ref). The latter would have been quite frustrating, because it = would cost execution time + memory + readability only to get around the=20 arguably artificial typing limitation of =3D=3D . Christophe __________________________ Ce message (et toutes ses pi=E8ces jointes =E9ventuelles) est = confidentiel et =E9tabli =E0 l'intention exclusive de ses destinataires. = Toute utilisation de ce message non conforme =E0 sa destination, toute = diffusion ou toute publication, totale ou partielle, est interdite, sauf = autorisation expresse. L'IFP d=E9cline toute responsabilit=E9 au titre = de ce message. This message and any attachments (the message) are confidential and = intended solely for the addressees. Any unauthorised use or = dissemination is prohibited. IFP should not be liable for this message. Visitez notre site Web / Visit our web site : http://www.ifp.fr __________________________