Browse thread
Re: [Caml-list] getting the type of a polymorphic data ?
-
Diego Olivier Fernandez Pons
-
Damien Doligez
- Diego Olivier Fernandez Pons
-
Damien Doligez
[
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: | Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@e...> |
| Subject: | Re: [Caml-list] getting the type of a polymorphic data ? |
Bonjour,
> Not quite.
>
> # Hashtbl.hash 0x4000_0000;;
> - : int = 0
> # Hashtbl.hash 0;;
> - : int = 0
Yes but
# let x = 0x4000_0000;;
val x : int = -1073741824
If the only case of collision is due to modulo 2^31 then it is - at
least for me - reasonable since the user is supposed to have a minimal
knowledge of computer science. And Caml allows him to check with
max_int / min_int for overflows.
(* obviously doesn't typecheck, just for example *)
let hashable = function x ->
x < max_int && x > min_int && Obj.is_int (Obj.repr x)
hashable x, y => hash injective
Diego Olivier
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners