Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: John Malecki <johnm@artisan.com>
To: Alain Frisch <frisch@clipper.ens.fr>
Cc: Basile STARYNKEVITCH <basile.starynkevitch@cea.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] Camlp4: varargs ie a la Printf
Date: Mon, 17 Jun 2002 09:20:17 -0700	[thread overview]
Message-ID: <15630.3137.985379.48421@spike.artisan.com> (raw)
In-Reply-To: <Pine.SOL.4.44.0206171656310.21487-100000@clipper.ens.fr>

Alain Frisch wrote (2002-06-17T16:59:05+0200):
 > On Mon, 17 Jun 2002, Basile STARYNKEVITCH wrote:
 > 
 > > My problem is to produce a quotation of a list of expressions (and not
 > > a quotation of a list expression). What should I put in place of the
 > > comment WHAT SHOULD BE ADDED HERE?   trace FOO "i=%d x=%g" i x end
 > 
 > I'm not sure to understand how this is more difficult than the solution
 > with Printf.kprintf; in both case, you want to generate a 'varargs'
 > application, right ?  Or what is a "list of expressions" ?
 > 
 > Try something like:
 > 
 > List.fold_left (fun e_1 e_2 -> <:expr< $e_1$ $e_2$ >>)

Here is what i normally use in my parsers

  let expr_of_list loc l =
    let f e l = <:expr< [$e$ :: $l$] >> in
    List.fold_right f l <:expr< [] >>

as in

  cnds: [ [ cs = LIST1 cnd SEP "and" -> expr_of_list loc cs ] ];
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-06-17 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-17 14:38 Basile STARYNKEVITCH
2002-06-17 14:59 ` Alain Frisch
2002-06-17 16:20   ` John Malecki [this message]
2002-06-18  6:27 ` Daniel de Rauglaudre

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=15630.3137.985379.48421@spike.artisan.com \
    --to=johnm@artisan.com \
    --cc=basile.starynkevitch@cea.fr \
    --cc=caml-list@inria.fr \
    --cc=frisch@clipper.ens.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