From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 6DE49BB9C for ; Wed, 23 Nov 2005 20:40:18 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jANJeHM4010201 for ; Wed, 23 Nov 2005 20:40:18 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA10288 for ; Wed, 23 Nov 2005 20:40:17 +0100 (MET) Received: from irma.motion-twin.com (irma.motiontwin.com [213.186.50.39]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jANJeGeW010198 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 23 Nov 2005 20:40:17 +0100 Received: from [82.225.176.25] (helo=[192.168.0.1]) by irma.motion-twin.com with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.54) id 1Ef0TW-0002SS-BX; Wed, 23 Nov 2005 20:40:14 +0100 Message-ID: <4384C7C0.6070503@motion-twin.com> Date: Wed, 23 Nov 2005 20:49:20 +0100 From: Nicolas Cannasse User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Hawkins Cc: caml-list@inria.fr Subject: Re: [Caml-list] Physical compare References: <4384C0E3.5030300@confluent.org> In-Reply-To: <4384C0E3.5030300@confluent.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4384C5A1.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4384C5A1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; cannasse:01 ncannasse:01 motion-twin:01 caml-list:01 wrote:01 equality:01 define:01 nicolas:02 nicolas:02 attribute:02 let:03 comparison:03 comparison:03 structural:04 break:07 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 Tom Hawkins wrote: > Is their a version of "compare" that is based on physical equality? If > not, how can I define one? I tried: > > let compareq a b = if a == b then 0 else if a > b then 1 else (-1) > > But unfortunately, (>) is a structural comparison. > > I need to make a Map where the keys are distinguished by the physical > instance. > > Thanks! > > -Tom It's not possible. One of the reason is that the GC might move your memory addresses around and then break your Map constitency. You need to attribute an unique id to each of your items and use it for comparison. Nicolas