Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: ancient module
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Erkki Seppala <flux-caml@i...>
Subject: Re: [Caml-list] Re: ancient module
Richard Jones <rich@annexia.org> 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                                  \/