From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id D8B15BB81 for ; Mon, 15 Nov 2004 03:20:27 +0100 (CET) Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by nez-perce.inria.fr (8.13.0/8.13.0) with SMTP id iAF2KQnw000458 for ; Mon, 15 Nov 2004 03:20:27 +0100 Received: from katsura.parc.xerox.com ([13.2.18.21]) by alpha.xerox.com with SMTP id <176198(2)>; Sun, 14 Nov 2004 18:20:08 PST Received: (from ruml@localhost) by katsura.parc.xerox.com (8.12.8/8.12.8/PARC RedHat Custom Submit 1.3) id iAF2K7uZ000466; Sun, 14 Nov 2004 18:20:07 -0800 From: Wheeler Ruml MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16792.4688.306149.402656@katsura.parc.xerox.com> Date: Sun, 14 Nov 2004 18:20:00 PST To: John Malecki Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Hashtbls with physical equality? In-Reply-To: <20041115012212.GA6561@artisan.com> References: <16791.56417.334890.765954@katsura.parc.xerox.com> <20041115012212.GA6561@artisan.com> X-Mailer: VM 7.07 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Miltered: at nez-perce with ID 4198126A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; wheeler:01 caml-list:01 ocaml:01 hash:01 hashtbl:01 struct:01 hash:01 hashtbl:01 bounded:01 wheeler:01 alto:98 equality:01 computation:01 string:03 module:03 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: > > Is it possible in OCaml to have a hash table that can insert and retrieve > > values without walking over their structure? > > How about something like this? > > module PhysrefHashtbl = > Hashtbl.Make (struct type t = string > let equal = (==) > let hash = Hashtbl.hash > end) My only concern about this solution is that Hashtbl.hash will walk over the key's structure in order to compute its hash value. I know that its computation is bounded, but I'd still love to find something faster and more more direct if possible. Thanks, Wheeler -- Wheeler Ruml, Palo Alto Research Center, Rm 1522, 650-812-4329 voice ruml@parc.com, http://www.parc.com/ruml 650-812-4334 fax