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=1.1 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 71FA0BC0B for ; Tue, 30 Jan 2007 22:08:08 +0100 (CET) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l0UL87h9020301 for ; Tue, 30 Jan 2007 22:08:08 +0100 Received: by ug-out-1314.google.com with SMTP id k3so1556912ugf for ; Tue, 30 Jan 2007 13:08:04 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=tBUVQhzCkLEPyXbfGPVEXSaw37+G02AvGCUYB9BVqSKpknMHOPf5AWDcavymjcj2eh/uiT3MuD5lr//fxm/eXSXYP7B4ySBAEN8ZbrvDxB/kMi+hMhYCGW9sh3NRMkYVGGkEimbZeTuxPkM937l9KdhPfNT9dPTircwbnUYp9NY= Received: by 10.82.152.16 with SMTP id z16mr256508bud.1170191283935; Tue, 30 Jan 2007 13:08:03 -0800 (PST) Received: by 10.82.175.13 with HTTP; Tue, 30 Jan 2007 13:08:03 -0800 (PST) Message-ID: Date: Tue, 30 Jan 2007 22:08:03 +0100 From: Tom To: "Christophe TROESTLER" Subject: Re: [Caml-list] Equality of functional values Cc: "O'Caml Mailing List" In-Reply-To: <20070130.220141.72363004.Christophe.Troestler@umh.ac.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_157097_30146184.1170191283791" References: <1170189001.21265.9.camel@localhost.localdomain> <20070130204109.GB15659@gaia.cc.gatech.edu> <20070130.220141.72363004.Christophe.Troestler@umh.ac.be> X-j-chkmail-Score: MSGID : 45BFB3B7.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45BFB3B7.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 pervasives:01 val:01 gerd:01 stolpmann:01 pervasives:01 val:01 equality:01 exception:01 exception:01 caml-list:01 functions:01 functions:01 int:01 X-Attachments: cset="UTF-8" cset="UTF-8" ------=_Part_157097_30146184.1170191283791 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline > > Why not take the suggestion of Gerd Stolpmann and declare > > let ( = ) x y = Pervasives.compare x y = 0 > > at the beginning of your files ? Because it fails on functions (if functions are the same, it returns true, otherwise it raises an exception... # let f x y = x + y;; val f : int -> int -> int = # compare f f;; - : int = 0 # compare (f 0) (f 0);; Exception: Invalid_argument "equal: functional value". ------=_Part_157097_30146184.1170191283791 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline
 Why not take the suggestion of Gerd Stolpmann and declare

  let ( = ) x y = Pervasives.compare x y = 0

at the beginning of your files ?


Because it fails on functions (if functions are the same, it returns true, otherwise it raises an exception...

# let f x y = x + y;;
val f : int -> int -> int = <fun>
# compare f f;;
- : int = 0
# compare (f 0) (f 0);;
Exception: Invalid_argument "equal: functional value".

------=_Part_157097_30146184.1170191283791--