caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: "Joel Reymont" <joelr1@gmail.com>
Cc: "Caml List" <caml-list@inria.fr>
Subject: Re: Upgrading sexplib-2.7.0 to camlp4 3.10
Date: Mon, 30 Apr 2007 17:19:34 +0200	[thread overview]
Message-ID: <cd67f63a0704300819n481f1b63hf38b55b1084cb12@mail.gmail.com> (raw)
In-Reply-To: <E89999CC-F884-4D13-913F-76753B6CCABD@gmail.com>

On 4/30/07, Joel Reymont <joelr1@gmail.com> 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


  reply	other threads:[~2007-04-30 15:19 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 13:55 Joel Reymont
2007-04-30 14:01 ` Nicolas Pouillard
2007-04-30 14:07   ` Joel Reymont
2007-04-30 14:17     ` Nicolas Pouillard
2007-04-30 14:31       ` Joel Reymont
2007-04-30 14:46       ` Joel Reymont
2007-04-30 15:19         ` Nicolas Pouillard [this message]
2007-04-30 15:29           ` Joel Reymont
2007-04-30 15:46             ` Nicolas Pouillard
2007-04-30 19:44               ` Joel Reymont
2007-04-30 21:08                 ` Joel Reymont
2007-05-01  7:20                   ` Nicolas Pouillard
2007-05-01 13:21                     ` Joel Reymont
2007-05-01 13:35                       ` Nicolas Pouillard
2007-05-01 13:54                         ` Joel Reymont
2007-05-01 14:16                           ` Nicolas Pouillard
2007-05-01 14:31                             ` Joel Reymont
2007-05-01 15:49                               ` Nicolas Pouillard
2007-05-01 16:14                                 ` Joel Reymont
2007-05-01 16:27                                   ` Nicolas Pouillard
2007-05-01 16:35                                     ` Joel Reymont
2007-05-01 16:39                                       ` Nicolas Pouillard
2007-05-01 16:50                                         ` Joel Reymont
2007-05-01 17:13                                           ` Nicolas Pouillard
2007-05-01 17:04                                     ` camlp4 3.10: Matching variant types Joel Reymont
2007-05-03  5:58                                       ` [Caml-list] " Dmitry Bely
2007-05-01 16:05                             ` Upgrading sexplib-2.7.0 to camlp4 3.10 Joel Reymont
2007-05-01 16:19                               ` Nicolas Pouillard
2007-04-30 21:16               ` Joel Reymont

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd67f63a0704300819n481f1b63hf38b55b1084cb12@mail.gmail.com \
    --to=nicolas.pouillard@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=joelr1@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).