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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id B0B1DBC58 for ; Wed, 15 Sep 2010 09:41:36 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjIBAC8VkEyC5gQqmWdsb2JhbACUFY1aFQEBAQEBCAsKBxEiwxGFQQSERYVn X-IronPort-AV: E=Sophos;i="4.56,370,1280700000"; d="scan'208";a="59294198" Received: from mail.cs.tut.fi ([130.230.4.42]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Sep 2010 09:41:36 +0200 Received: from amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) by mail.cs.tut.fi (Postfix) with ESMTP id 5B07E128C for ; Wed, 15 Sep 2010 10:41:35 +0300 (EEST) Received: from mail.cs.tut.fi ([130.230.4.42]) by amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) (amavisd-maia, port 10024) with ESMTP id 04219-26 for ; Wed, 15 Sep 2010 10:41:34 +0300 (EEST) Received: from modeemi.modeemi.fi (modeemi.modeemi.fi [130.230.72.134]) by mail.cs.tut.fi (Postfix) with ESMTP id 868E91289 for ; Wed, 15 Sep 2010 10:41:34 +0300 (EEST) Received: from coffee.modeemi.fi (coffee.modeemi.fi [130.230.72.140]) by modeemi.modeemi.fi (Postfix) with ESMTP id 70E533A761 for ; Wed, 15 Sep 2010 10:41:34 +0300 (EEST) Received: by coffee.modeemi.fi (Postfix, from userid 17990) id 6325E2D61AD; Wed, 15 Sep 2010 10:41:34 +0300 (EEST) From: Erkki Seppala To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Re: ancient module References: <7366F08F-88A4-40BA-95EE-1E682BEDBEFA@facebook.com> <20100914204624.GA1246@annexia.org> <20100914204817.GA25213@annexia.org> Date: Wed, 15 Sep 2010 10:41:34 +0300 In-Reply-To: <20100914204817.GA25213@annexia.org> (Richard Jones's message of "Tue, 14 Sep 2010 21:48:17 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.2 X-Spam: no; 0.00; 0100,:01 hashtbl:01 hash:01 hashtbl:01 hashedtype:01 hashing:01 hashing:01 o'caml:01 compiler:01 wrote:01 heap:01 caml-list:01 writes:01 strings:01 data:02 Richard Jones writes: > On Tue, Sep 14, 2010 at 09:46:24PM +0100, Richard Jones wrote: > Answering my own question, I guess you can use Map, but write a custom > string comparison function. Ought to work but not tested it :-) And in similar fashion, one could use Hashtbl.Make to construct a custom hash table with Hashtbl.HashedType, but provide a custom hashing (and comparison) function. I assume also the default hashing function stops upon finding data that's outside O'Caml heap. Also, the compiler recognizes when strings are compared and calls the comparing function directly. So let cmp (a : string) b = a < b produces a call directly to caml_string_lessthan, which I assume would not make any special checks. -- _____________________________________________________________________ / __// /__ ____ __ http://www.modeemi.fi/~flux/\ \ / /_ / // // /\ \/ / \ / /_/ /_/ \___/ /_/\_\@modeemi.fi \/