From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA28827; Thu, 12 Aug 2004 16:00:36 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA29725 for ; Thu, 12 Aug 2004 16:00:25 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7CE0ORM001112; Thu, 12 Aug 2004 16:00:24 +0200 Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i7CDxx1Q023364 ; Thu, 12 Aug 2004 15:59:59 +0200 (CEST) X-Ids: 164 Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id PAA121232 ; Thu, 12 Aug 2004 15:58:20 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id PAA647280 ; Thu, 12 Aug 2004 15:57:58 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Thu, 12 Aug 2004 15:57:57 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: Damien Doligez cc: caml Caml Subject: Re: [Caml-list] getting the type of a polymorphic data ? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 411B77F8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 411B77DF.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pons:01 pons:01 etu:99 caml-list:01 hashtbl:01 hash:01 hashtbl:01 hash:01 val:01 collision:01 overflows:01 typecheck:01 fernandez:01 fernandez:01 caml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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