caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] camlp4 and anonymous function naming
Date: Wed, 3 Jul 2002 10:08:09 +0200	[thread overview]
Message-ID: <20020703100809.D23414@verdot.inria.fr> (raw)
In-Reply-To: <Pine.BSF.4.44.0207021635090.78988-100000@bowser.eecs.harvard.edu>; from farago@eecs.harvard.edu on Tue, Jul 02, 2002 at 04:48:22PM -0400

Hi,

On Tue, Jul 02, 2002 at 04:48:22PM -0400, Julie Farago wrote:

> let givenames loc vars e =
>   let name = namefun "my" in
>     <:expr<
>       let $lid:name$ $vars$ = $e$
>       in $lid:name$ >>
> 
> This code is, of course, wrong. The problem is that I cannot figure out
> how to simply capture the args from the fun and place them back into the
> let.

Write this function like this:

let givenames loc vars e =
  let name = namefun "my" in
  let e =
    List.fold_right (fun p e -> <:expr< fun $lid:p$ -> $e$ >>) vars e
  in
    <:expr<
      let $lid:name$ = $e$
      in $lid:name$ >>

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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-07-03  8:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-02 18:56 [Caml-list] embedding OCaml into C on win32 Alexander V.Voinov
2002-07-02 20:48 ` [Caml-list] camlp4 and anonymous function naming Julie Farago
2002-07-03  8:08   ` Daniel de Rauglaudre [this message]
2002-07-02 21:30 ` [Caml-list] embedding OCaml into C on win32 Alexander V.Voinov
2002-07-02 22:32   ` Alexander V.Voinov

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=20020703100809.D23414@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --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).