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 9ED65BC0A for ; Tue, 13 Feb 2007 23:03:32 +0100 (CET) Received: from coriana6.cis.mcmaster.ca (coriana6.CIS.McMaster.CA [130.113.128.17]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1DM3V9A010204 for ; Tue, 13 Feb 2007 23:03:32 +0100 Received: from Gorash7.UTS.McMaster.CA (Gorash7.UTS.mcmaster.ca [130.113.196.61]) by coriana6.cis.mcmaster.ca (8.13.7/8.13.7) with ESMTP id l1DM3JCX015889 for ; Tue, 13 Feb 2007 17:03:27 -0500 (EST) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.mcmaster.ca [130.113.64.46]) by Gorash7.UTS.McMaster.CA (8.13.7/8.13.7) with ESMTP id l1DM36Q0026437 for ; Tue, 13 Feb 2007 17:03:06 -0500 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca [130.113.68.27] verified) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.1.8) with ESMTP id 162104883 for caml-list@inria.fr; Tue, 13 Feb 2007 17:03:07 -0500 Message-ID: <45D23608.4030104@mcmaster.ca> Date: Tue, 13 Feb 2007 17:04:56 -0500 From: Jacques Carette Organization: McMaster University User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: OCaml Subject: Patterns that evaluate Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version-Mac: 4.7.1.128075, Antispam-Engine: 2.4.0.264935, Antispam-Data: 2007.2.13.133934 X-PerlMx-Spam: Gauge=IIIIIII, Probability=7%, Report='__CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __SANE_MSGID 0, __USER_AGENT 0' X-Miltered: at concorde with ID 45D235B3.005 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml's:01 bug:01 categorical:01 semantics:01 wrote:01 wrote:01 wolfram:01 calculus:01 match:02 mcmaster:02 jacques:03 jacques:03 describing:03 let:03 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. Question: would it be a difficult extension? This seemed so "natural", I just "used" the feature before it was quite there yet ;-). Jacques PS: I guess I had first-class patterns on the brain; Maple has them [under the misleadingly-named function "typematch"] (but that's cheating, I know) and W. Kahl's Pattern Matching Calculus allows it, and I wrote a joint paper with Wolfram describing a categorical semantics for the PMC.