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 8AC83BB83 for ; Wed, 6 Sep 2006 19:51:14 +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 k86HpEd8003054 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 6 Sep 2006 19:51:14 +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 k86HpDrF093059 for ; Wed, 6 Sep 2006 19:51:13 +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 TAA1491090 for ; Wed, 6 Sep 2006 19:50:58 +0200 Date: Wed, 6 Sep 2006 19:50:57 +0200 (DST) From: Diego Olivier Fernandez Pons Reply-To: diego-olivier.fernandez-pons@cicrp.jussieu.fr To: caml-list@inria.fr Subject: Equality/Hashtable for functions (inline help feature) In-Reply-To: <44FF033C.3040405@abc.se> 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]); Wed, 06 Sep 2006 19:51:13 +0200 (CEST) X-Virus-Scanned: ClamAV 0.88.2/1815/Wed Sep 6 17:42:27 2006 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at concorde with ID 44FF0A92.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 44FF0A91.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; pons:01 pons:01 hashtable:01 bool:01 computes:01 computes:01 hash:01 bool:01 equality:01 equality:01 wrote:01 integer:01 inline:01 inline:01 functions:01 Bonjour, I would like to write a (non intrusive) inline help feature for some modules I wrote, that would look like # help MyModule.is_prime; - : string = "is_prime : int -> bool computes if an integer given as a parameter is prime" # help MyModule.probabilistic_is_prime; - : string = "..." I can write a function of type 'a -> string which computes the hash key of the parameter and returns the string associated in a table, but I cannot do a physical equality based desambigusation for collision since the equality is typed let f = function x -> x + 1 and g = function x -> x + 2 in (f == f, f == g) - : bool * bool = (true, false) let f = function x -> x + 1 and g = fun x y -> x + y in (f == f, f == g) This expression has type int -> int -> int but is here used with type int -> int Does anyone know how I could circumvent this problem ? Diego Olivier