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 KAA02676; Fri, 13 Aug 2004 10:17:35 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA01850 for ; Fri, 13 Aug 2004 10:17:34 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i7D8HXmL015697 for ; Fri, 13 Aug 2004 10:17:33 +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 i7D8GcgI091023 ; Fri, 13 Aug 2004 10:16:39 +0200 (CEST) X-Ids: 166 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 KAA14028 ; Fri, 13 Aug 2004 10:15:24 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id KAA647346 ; Fri, 13 Aug 2004 10:15:03 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Fri, 13 Aug 2004 10:15:03 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: Jean-Baptiste Rouquier cc: caml-list@inria.fr Subject: Re: [Caml-list] getting the type of a polymorphic data ? In-Reply-To: <1092334731.411bb48b56f4e@mouette.ens-lyon.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 411C791D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 411C78E7.000 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 foo:01 hashtbl:01 hash:01 hashing:01 isomorphic:01 isomorphic:01 fernandez:01 fernandez:01 bool:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, > > Is it reasonable to admit that if Obj.is_int is true for x and y then > > Hashtbl.hash is injective ? > > No. > > # type foo = A | B;; > # let _ = Obj.is_int (Obj.repr 0);; > - : bool = true > # let _ = Obj.is_int (Obj.repr A);; > - : bool = true > # let _ = Hashtbl.hash A;; > - : int = 0 > # let _ = Hashtbl.hash 0;; > - : int = 0 I meant injective for a given (fixed) type. Obviously it won't in a completely general case ! > The purpose of Hashtbl.hash is exactly no to be injective ! And > hashing lists can't be injective. That is why I said "isomorphic to a (finite) subset of (machine) integers". And I said "isomorphic", not "in bijection" to be able to add a few properties behind when needed and exclude the N x N ~ N argument. 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