caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: caml-list@inria.fr
Subject: Camlp4 3.10.0+beta: lists without $list:...$
Date: Thu, 22 Mar 2007 23:13:23 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0703222255530.2958@droopy> (raw)

I managed to create an object type using camlp4orf:

let ctyp_object _loc ml =
   let fields =
     List.fold_left
       (fun o (name, typ) ->
 	 let m = <:ctyp< $lid:name$ : $typ$ >> in
 	 <:ctyp< $o$; $m$ >>)
       <:ctyp< >> ml in
   <:ctyp< < $fields$ > >>

where ml is a list of method declarations of type (string * ctyp) list.
Before we just had to do this:

<:ctyp< < $list:ml$ > >>


Is there anything simpler than my solution? Is a shortcut available?


If not, I think there should really be one. By the way, there should also 
be some shortcut for building list patterns and expressions without 
List.fold_*. A library could do that.


Martin


PS: any progress on the manual? It's kind of hard to test new features 
when you don't know what they are.

--
Martin Jambon
http://martin.jambon.free.fr


             reply	other threads:[~2007-03-23  6:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23  6:13 Martin Jambon [this message]
2007-03-23 16:03 ` [Caml-list] " Markus Mottl
2007-03-23 16:35 ` Nicolas Pouillard
2007-03-23 19:00   ` Martin Jambon
2007-03-24 12:21     ` Nicolas Pouillard
2007-03-24 20:24       ` Martin Jambon
2007-03-26  6:48         ` Markus Mottl
2007-03-26  7:27       ` Hendrik Tews

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=Pine.LNX.4.64.0703222255530.2958@droopy \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    /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).