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.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, 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 57064BC69 for ; Tue, 19 Sep 2006 03:26:17 +0200 (CEST) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.195]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8J1QGqO013982 for ; Tue, 19 Sep 2006 03:26:17 +0200 Received: by nz-out-0102.google.com with SMTP id 12so1579621nzp for ; Mon, 18 Sep 2006 18:26:16 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=kZkAaaC2ppgGRTAsA7Iq8eegn1IrNeX7RPi/PZwUKGHy5jd+f8BmyYayjqciBYgpsTaaaC5zz+vcfldnnCdnZ1VEQGmWgMEhOFNyw8WTnTbGJkr47E1VgqfdF9YBxYJCgWCOfURH3NPTrGpYIytSWvAkk/O8DafPVFSMWBFqw1s= Received: by 10.64.143.4 with SMTP id q4mr16514279qbd; Mon, 18 Sep 2006 18:26:15 -0700 (PDT) Received: by 10.65.151.17 with HTTP; Mon, 18 Sep 2006 18:26:15 -0700 (PDT) Message-ID: <6dbd4d000609181826p6beca937y515903dc76628fc3@mail.gmail.com> Date: Mon, 18 Sep 2006 21:26:15 -0400 From: "Denis Bueno" To: "OCaml Mailing List" Subject: Variable pattern matching tuple MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 450F4738.001 on discorde : j-chkmail score : X : 0/20 1 X-Miltered: at discorde with ID 450F4738.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; foo:01 val:01 foo:01 compile:01 constructor:01 expression:01 expression:01 int:01 int:01 argument:02 argument:02 tuple:02 tuple:02 match:02 match:02 The following is not intuitive to me. # type 'a withint = Withint of 'a * int;; type 'a withint = Withint of 'a * int # let foo = Withint ("hi there", 4);; val foo : string withint = Withint ("hi there", 4) # match foo with Withint _ -> ();; - : unit = () # match foo with Withint d -> d;; (* expression A*) Characters 15-24: match foo with Withint d -> d;; ^^^^^^^^^ The constructor Withint expects 2 argument(s), but is here applied to 1 argument(s) # What is the reason that expression A won't compile? Can't one variable stand for a tuple in a pattern-matching clause? -Denis