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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 784C7BC68 for ; Tue, 19 Sep 2006 03:40:36 +0200 (CEST) Received: from mail.rsise.anu.edu.au (mail.rsise.anu.edu.au [150.203.208.4]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8J1eW3d015481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 19 Sep 2006 03:40:36 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id AA820542BA; Tue, 19 Sep 2006 11:40:28 +1000 (EST) Received: from mail.rsise.anu.edu.au ([150.203.208.4]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08820-06; Tue, 19 Sep 2006 11:40:28 +1000 (EST) Received: from pulp.rsise.anu.edu.au (pulp.rsise.anu.edu.au [150.203.208.49]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id 8B90B54296; Tue, 19 Sep 2006 11:40:21 +1000 (EST) Received: by pulp.rsise.anu.edu.au (Postfix, from userid 1560) id 42967A0AFC7; Tue, 19 Sep 2006 11:40:33 +1000 (EST) Date: Tue, 19 Sep 2006 11:40:33 +1000 From: Pietro Abate To: caml-list@yquem.inria.fr, OCaml Mailing List Subject: Re: [Caml-list] Variable pattern matching tuple Message-ID: <20060919014033.GA24064@pulp.rsise.anu.edu.au> Mail-Followup-To: Pietro Abate , caml-list@yquem.inria.fr, OCaml Mailing List References: <6dbd4d000609181826p6beca937y515903dc76628fc3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6dbd4d000609181826p6beca937y515903dc76628fc3@mail.gmail.com> X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Australian National University) User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mail.rsise.anu.edu.au X-Miltered: at discorde with ID 450F4A90.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; foo:01 val:01 foo:01 ocaml:01 2006:98 blog:98 blog:98 beginners:01 beginners:01 wrote:01 compile:01 caml-list:01 expression:01 int:01 int:01 On Mon, Sep 18, 2006 at 09:26:15PM -0400, Denis Bueno wrote: > What is the reason that expression A won't compile? Can't one variable > stand for a tuple in a pattern-matching clause? somebody was discussing a similar issue on the beginners mailing list this week: 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 d -> d;; ;; - : string * int = ("hi there", 4) if you want to pattern match the tuple you need to add parenthesis in the type declaration. have a look here for a detailed explanation: http://www.archivesat.com/Ocaml_Beginners/thread1620469.htm :) p -- ++ Blog: http://blog.rsise.anu.edu.au/?q=pietro ++ ++ "All great truths begin as blasphemies." -George Bernard Shaw ++ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html