Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Re: [Caml-list] possible to define a type where = is forbidden ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-10-12 (07:42)
From: Hendrik Tews <tews@t...>
Subject: Re: [Caml-list] EQ hash tables?
Thomas Fischbacher <Thomas.Fischbacher@Physik.Uni-Muenchen.DE> writes:

   Actually, this brings me to a question I wanted to ask for a long time: 
   while I never used this so far, I just assumed that OCaml does provide 
   hash tables where keys are compared w.r.t. "being the same" ('==' , that 
   is), rather than only hash tables where keys are compared for "being 
   equal" (say, '=').
Just look at

    let find h key =
      match key) mod (Array.length with
        Empty -> raise Not_found
      | Cons(k1, d1, rest1) ->
          if compare key k1 = 0 then d1 else

So it's structual equality, which is the same as '=' modulo the
float nan issue.