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.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 6A927BC69 for ; Mon, 30 Apr 2007 17:19:38 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.230]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l3UFJZqq031188 for ; Mon, 30 Apr 2007 17:19:36 +0200 Received: by wr-out-0506.google.com with SMTP id l58so1543648wrl for ; Mon, 30 Apr 2007 08:19:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZIj5drmlCakz7iayPUTs1im8s26lZFd8+hqcHYqYXr1qDplk7zDsLyfHuyMsWNvMEX3AOANP2VoBRaH7HGzzpo8B7u3CNYLf8Dw4TfX32anxPxaeC7rS31nG0hw3dpRjwv+WeHKv/P/cCfwZC3HRr4L87Odj7a/9tlgd6j+5cK8= 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=WUijQlrTtOBNoZ29hVlDN3kpZUKn7F2CHkzb9tnzLVDO2Cbjgpt/0ZmvVc2VKah6oQUX5jCpzSOQ8epNegfdjQIYt4U7otdKk05iddfxRaGLKW8P5EmTQzOAVd9kxyZOhGzb3NWZqNlbOPOCP6bzhDAGr5Y8Xcc9YdgzNkta0SM= Received: by 10.114.15.1 with SMTP id 1mr2027268wao.1177946374553; Mon, 30 Apr 2007 08:19:34 -0700 (PDT) Received: by 10.114.181.18 with HTTP; Mon, 30 Apr 2007 08:19:34 -0700 (PDT) Message-ID: Date: Mon, 30 Apr 2007 17:19:34 +0200 From: "Nicolas Pouillard" To: "Joel Reymont" Subject: Re: Upgrading sexplib-2.7.0 to camlp4 3.10 Cc: "Caml List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <220DCCF0-FD2D-4116-8E30-992C1AD3FE95@gmail.com> X-j-chkmail-Score: MSGID : 46360907.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46360907.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ctyp:01 ctyp:01 params:01 failwith:01 syntax:01 polymorphism:01 params:01 wrote:01 rec:01 ident:02 poly:02 poly:02 match:02 match:02 On 4/30/07, Joel Reymont wrote: > What does this match? I assume that $list...$ is a list but the dot > in the middle throws me off. > > | <:ctyp< ! $list:parms$ . $tp$ >> -> poly _loc parms tp > > Is this a good translation? > > | <:ctyp< ! $id:id$ >> -> > (match id with > | <:ident< $list:params$ . $tp$ >> -> > poly _loc parms tp > | _ -> failwith "fold_tp: unknown type") No, the dot here is not the same it's part of the syntax for rank-2 polymorphism. t ::= ... | ! 'a ... 'z . t Having a function to unfold 'a ... 'z to a list. let unfold_params x = let rec loop x acc = match x with | <:ctyp<>> -> acc | <:ctyp< $x$ $y$ >> -> loop x (loop y acc) | x -> x :: acc in loop x [];; ... | <:ctyp< ! $params$ . $t$ >> -> poly _loc (unfold_params params) t ... -- Nicolas Pouillard