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 JAA29909; Mon, 4 Feb 2002 09:52:22 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 JAA30336 for ; Mon, 4 Feb 2002 09:52:21 +0100 (MET) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g148qL116945 for ; Mon, 4 Feb 2002 09:52:21 +0100 (MET) Received: from pc803.lri.fr (mail@pc803 [129.175.8.114]) by lri.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id g148q1F13494 ; Mon, 4 Feb 2002 09:52:01 +0100 (MET) Received: from filliatr by pc803.lri.fr with local (Exim 3.33 #1 (Debian)) id 16Xer5-0003P4-00; Mon, 04 Feb 2002 09:52:03 +0100 From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15454.19378.938606.343766@pc803.lri.fr> Date: Mon, 4 Feb 2002 09:52:02 +0100 (MET) To: doug@bagley.org (Doug Bagley) Cc: caml-list@inria.fr Subject: Re: [Caml-list] some Hashtbl observations In-Reply-To: <15453.36509.586757.825002@ns.bagley.org> References: <15453.36509.586757.825002@ns.bagley.org> X-Mailer: VM 6.49 under Emacs 20.7.2 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > D'oh! So I guess I shouldn't use an type as a hash key in the > generic Hashtbl interface. That makes sense in hindsight. There is actually another issue related to ocaml bignums related to generic hash and equalit functions: the lack of unique representation. Indeed, type "num" is defined as ====================================================================== type num = Int of int | Big_int of Big_int.big_int | Ratio of Ratio.ratio ====================================================================== (to improve computations over small integers or big integers not being rationals) but a given rational may have several representations (e.g. 1 may be (Int 1) sometimes and some ratio (Ratio ...) later). Thus, even if hash and equality would not fail on the abstract type ratio, they would fail to hash or compare properly two different representations of the same number (generic hash and equality functions are---among other things---based on constructors tags). Hope this helps, -- Jean-Christophe Filliatre (http://www.lri.fr/~filliatr) ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr