caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: blue storm <bluestorm.dylc@gmail.com>
To: Anastasia Gornostaeva <ermine@ermine.pp.ru>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] camlp4 + array
Date: Sun, 4 Oct 2009 19:44:59 +0200	[thread overview]
Message-ID: <527cf6bc0910041044h3635079fk2dc694698c668bcb@mail.gmail.com> (raw)
In-Reply-To: <20091004170824.GB46755@ermine.home>

I suppose you are using the "classical syntax" inside the quotations
(camlp4oof).
You can correct the misbehaviour by switching to the revised syntax
inside the quotations (camlp4orf), but that may require some changes
to your code elsewhere.

I think the easier way to code that with the classical syntax inside
quotations is to use the Ast.exSem_of_list construct :

let quote_int_array arr =
  let quoted_elems = List.map (fun i -> <:expr< $`int:i$ >>)
(Array.to_list arr) in
  <:expr< [| $Ast.exSem_of_list quoted_elems |]$ >>


2009/10/4 Anastasia Gornostaeva <ermine@ermine.pp.ru>:
> Hello.
>
> The code
>
>       let pl =
>            Array.fold_left (fun ls l -> <:expr< $ls$; $`int:l$ >>)
>            <:expr<>> some_array
>          in
>            <:expr< [| $pl$ |] >>
>
> produces somelike [| (1; 2; 3; 4) |], i.e the pl in () brackets.
> How should I do write this code properly?
>
> ermine
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


      reply	other threads:[~2009-10-04 17:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-04 17:08 Anastasia Gornostaeva
2009-10-04 17:44 ` blue storm [this message]

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=527cf6bc0910041044h3635079fk2dc694698c668bcb@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=ermine@ermine.pp.ru \
    /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).