From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id A4631BBAF for ; Mon, 24 Aug 2009 09:01:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuUDAIrXkUqBrw8EgWdsb2JhbACbBwEBFiS3HoQaBQ X-IronPort-AV: E=Sophos;i="4.44,264,1249250400"; d="scan'208";a="32796173" Received: from ext.lri.fr ([129.175.15.4]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 24 Aug 2009 09:01:09 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 7A26BA4447 for ; Mon, 24 Aug 2009 09:01:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SUJEu8AeYKC6 for ; Mon, 24 Aug 2009 09:01:08 +0200 (CEST) Received: from [192.168.0.10] (mry91-1-82-229-156-20.fbx.proxad.net [82.229.156.20]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ext.lri.fr (Postfix) with ESMTP id 437FAA441E for ; Mon, 24 Aug 2009 09:01:08 +0200 (CEST) Message-ID: <4A923AB3.6080206@lri.fr> Date: Mon, 24 Aug 2009 09:01:07 +0200 From: =?ISO-8859-1?Q?Jean-Christophe_Filli=E2tre?= User-Agent: Thunderbird 1.5.0.14ubu (X11/20080925) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Physical counterpart to Pervasives.compare? References: <20090729030710.BB3C6BC5C@yquem.inria.fr> <60DA2C46-E67F-44BF-9ECC-625461BF10B5@cea.fr> In-Reply-To: <60DA2C46-E67F-44BF-9ECC-625461BF10B5@cea.fr> X-Enigmail-Version: 0.94.2.0 OpenPGP: url=http://www.lri.fr/~filliatr/mykey.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; filliatre:01 filliatre:01 lri:01 pervasives:01 cuoq:01 pervasives:01 hash-consing:01 lri:01 filliatr:01 publis:01 hash-consing:01 ocaml:01 filliatr:01 wrote:01 caml-list:01 Pascal Cuoq a écrit : >> Elnatan Reisner wrote: >>> Is there something that can complete this analogy: >>> (=) is to (==) as Pervasives.compare is to ___? >>> > The simple solution is to number at creation the objects that you want to > physically compare, using an additional field. You can do that while hash-consing your values, which has many other benefits than allowing physical comparison, as explained in this paper: http://www.lri.fr/~filliatr/ftp/publis/hash-consing2.pdf Ocaml code for hash-consing can be found on that page: http://www.lri.fr/~filliatr/software.en.html Hope this helps, -- Jean-Christophe