From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id DC594BB83 for ; Thu, 7 Sep 2006 12:32:11 +0200 (CEST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k87AWBGK014740 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 7 Sep 2006 12:32:11 +0200 Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by shiva.jussieu.fr (8.13.7/jtpda-5.4) with ESMTP id k87AWAHT041917 ; Thu, 7 Sep 2006 12:32:10 +0200 (CEST) X-Ids: 165 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda-5.3.3) with ESMTP id MAA1368088 ; Thu, 7 Sep 2006 12:31:57 +0200 Date: Thu, 7 Sep 2006 12:31:57 +0200 (DST) From: Diego Olivier Fernandez Pons Reply-To: diego-olivier.fernandez-pons@cicrp.jussieu.fr To: Jacques Garrigue Cc: diego-olivier.fernandez-pons@cicrp.jussieu.fr, Subject: Re: [Caml-list] Equality/Hashtable for functions (inline help feature) In-Reply-To: <20060907.091948.56533867.garrigue@math.nagoya-u.ac.jp> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (shiva.jussieu.fr [134.157.0.165]); Thu, 07 Sep 2006 12:32:11 +0200 (CEST) X-Virus-Scanned: ClamAV 0.88.2/1816/Thu Sep 7 04:29:36 2006 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at concorde with ID 44FFF52B.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 44FFF52A.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; pons:01 pons:01 hashtable:01 hashtables:01 hash:01 hash:01 hashtbl:01 hashtbl:01 equality:01 equality:01 caml-list:01 integer:01 integer:01 inline:01 functions:01 Bonjour, > Note that you cannot use hashtables, as the default hash function will > fail on functions, but you can use an association list with physical > equality. I dont understand why the hash function fails on functions. When I call Hashtbl.hash : 'a -> int with a function I get an integer. Does it mean the integer could change while the program is running ? # Hashtbl.hash (fun x -> x + 1);; - : int = 151020553 # Hashtbl.hash (fun x -> x + 2);; - : int = 151020609 # Hashtbl.hash (fun x y -> x + y);; - : int = 151020669 I had in mind a reduction of the search space based on the hash value and an association list with physical equallity test on the functions that have the same hash (collisions). Diego Olivier