Browse thread
Re: [Caml-list] possible to define a type where = is forbidden ?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| 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 hash.ml:
let find h key =
match h.data.((hash key) mod (Array.length h.data)) 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.
Bye,
Hendrik