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.2 required=5.0 tests=AWL,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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EE1F2BC0A for ; Wed, 14 Feb 2007 21:29:10 +0100 (CET) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1EKT9L2013213 for ; Wed, 14 Feb 2007 21:29:10 +0100 Received: by ug-out-1314.google.com with SMTP id k3so313070ugf for ; Wed, 14 Feb 2007 12:29:00 -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:content-transfer-encoding:content-disposition:references; b=jDhjM1aF483czh5p1NOXYV4y0laYRUZtOwG1VRFN2RxwTKe/4LD8nJ2+FwqTotbSyLVEPOksMwE0BYR4EIHzN7hu8n4WLgHBm0adWrme/m8cmlYnRMSBGCHMw7fUH+ELtzBi3E8fPevqROPPwqmssabsMAiYtUb+hUSi6iCdHEg= Received: by 10.78.193.5 with SMTP id q5mr311579huf.1171484940133; Wed, 14 Feb 2007 12:29:00 -0800 (PST) Received: by 10.78.198.14 with HTTP; Wed, 14 Feb 2007 12:29:00 -0800 (PST) Message-ID: Date: Wed, 14 Feb 2007 12:29:00 -0800 From: "Nathaniel Gray" To: "Jacques Carette" Subject: Re: [Caml-list] Patterns that evaluate Cc: OCaml In-Reply-To: <45D23608.4030104@mcmaster.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <45D23608.4030104@mcmaster.ca> X-j-chkmail-Score: MSGID : 45D37115.000 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 45D37115.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml's:01 bug:01 cheers:01 wrote:01 wrote:01 caml-list:01 match:02 mcmaster:02 jacques:03 let:03 guess:04 mistaken:04 caltech:05 caltech:05 On 2/13/07, Jacques Carette wrote: > I recently wrote some ocaml code which "worked", but not as I > intended... The test cases I tried worked, but I should have tested > harder. Apparently I was under the mistaken impression that OCaml's > pattern-matching was more "first class"! So I wrote (in part): > > let buildsimp cast e f1 f2 = fun e1 -> fun e2 -> match (e1,e2) with > | ({st = Some e}, _) -> e2 > > and I expected it to work. Only a code review by a colleague 'found' > this bug in my code. I guess I'm not seeing it. How did you expect it to work? Is this what you mean: ... | ({st = Some v}, _) when v = e -> e2 Is there some functionality that you're looking for that when clauses don't provide? Cheers, -n8 -- >>>-- Nathaniel Gray -- Caltech Computer Science ------> >>>-- Mojave Project -- http://mojave.cs.caltech.edu -->