From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B53CCBB84 for ; Tue, 9 May 2006 15:33:59 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k49DXxLX030071 for ; Tue, 9 May 2006 15:33:59 +0200 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 PAA30094 for ; Tue, 9 May 2006 15:33:58 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k49DXw5U011568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 9 May 2006 15:33:58 +0200 Received: from hydrogene.pps.jussieu.fr (hydrogene.pps.jussieu.fr [134.157.168.1]) by shiva.jussieu.fr (8.13.6/jtpda-5.4) with ESMTP id k49DXwU7045037 ; Tue, 9 May 2006 15:33:58 +0200 (CEST) X-Ids: 164 Received: from [134.157.168.58] (cerium.pps.jussieu.fr [134.157.168.58]) by hydrogene.pps.jussieu.fr (8.13.4/jtpda-5.4) with ESMTP id k49DXuCc016114 ; Tue, 9 May 2006 15:33:57 +0200 Message-ID: <44609A44.1020304@ens-lyon.org> Date: Tue, 09 May 2006 15:33:56 +0200 From: Samuel Mimram User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: Christophe Raffalli Cc: caml-list Subject: Re: [Caml-list] is this a bug ? References: <44609473.6030004@univ-savoie.fr> <446096F0.6000405@ens-lyon.org> <44609882.7090908@univ-savoie.fr> In-Reply-To: <44609882.7090908@univ-savoie.fr> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (shiva.jussieu.fr [134.157.0.164]); Tue, 09 May 2006 15:33:58 +0200 (CEST) X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Miltered: at concorde with ID 44609A47.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44609A46.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 44609A46.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; ens-lyon:01 bug:01 christophe:01 raffalli:01 christophe:01 raffalli:01 bug:01 syntax:01 wrote:01 wrote:01 caml-list:01 int:01 int:01 newline:02 match:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Christophe Raffalli wrote: > Samuel Mimram a écrit : >> Christophe Raffalli wrote: >> >>> -------------------------------- >>> let f b l = match l with >>> [] | [_] -> 1 >>> | [a;_] | [_;a] when a = b-> 2 >>> | _ -> 3 >>> >>> let _ = >>> print_int (f 1 [1;2]); >>> print_int (f 1 [2;1]); >>> print_newline () >>> -------------------------------- >>> >>> Do you think this code should have a useless pattern warning and print >>> "23" instead of "22" ? >>> >>> If someone tell me this is a bug then I fill a bug report ... >> >> I guess that the priorities says that you should "read" the third line as >> >> | [a;_] | ( [_;a] when a = b ) -> 2 > > but the you should be allowed to write > > | ([a;_] when a = b) | ( [_;a] when a = b ) -> 2 > > but this results in a syntax error ... Yes, in fact I answered too quickly. The answers would have been 22 in both cases. Moreover, let f x = match x with | z | y when y = 0 -> 0 | _ -> 1 ;; results in "Variable y must occur on both sides of this | pattern"... Samuel.