From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.2 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 82924BBAF for ; Sun, 4 Oct 2009 19:45:00 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtUBAL97yErRVdK2kGdsb2JhbACPSYFxiH0/AQEBAQkJDAcTA6N/gTuNXAEDAwWEJQSBUg X-IronPort-AV: E=Sophos;i="4.44,503,1249250400"; d="scan'208";a="35614053" Received: from mail-yx0-f182.google.com ([209.85.210.182]) by mail3-smtp-sop.national.inria.fr with ESMTP; 04 Oct 2009 19:44:59 +0200 Received: by yxe12 with SMTP id 12so2527714yxe.1 for ; Sun, 04 Oct 2009 10:44:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=fg8WNdfafwwZnei/XZCNgneXqJbBVDppcYNmd3AQ+RA=; b=k8YGp8PlV6KsqGQtenuQbK2+LDsoDqcyGQXBWxQsK05+nxPptumr3xHtSm3RteXjOy WZPkjzVY8vG112WTehbqwihmDLGpW6lkhuW2h2KUuyojb/MTyeF8/MQjMepSBphbS5JN YAkJLgVq+g126v0xbYx/bEHj2z9LWXugM2C2o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=P904Kyi+RZzzw+Hj0wwoZjLwDFNlHcH+2KR6vLBDxDAgohtJ3hv/Dwzwsl+F2629HO QlKsaUU75zopMEYnEXmw5josP2xkBJJqUjitkNQsumuJEEBQ1JA8LY3m01lxwkaTJ6x4 nVIKHl6mpHKG//TM/qxDvJGAoORaIUe35PRBM= MIME-Version: 1.0 Received: by 10.101.165.2 with SMTP id s2mr4735375ano.16.1254678299317; Sun, 04 Oct 2009 10:44:59 -0700 (PDT) In-Reply-To: <20091004170824.GB46755@ermine.home> References: <20091004170824.GB46755@ermine.home> Date: Sun, 4 Oct 2009 19:44:59 +0200 Message-ID: <527cf6bc0910041044h3635079fk2dc694698c668bcb@mail.gmail.com> Subject: Re: [Caml-list] camlp4 + array From: blue storm To: Anastasia Gornostaeva Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; camlp:01 syntax:01 camlp:01 syntax:01 expr:01 expr:01 beginner's:01 ocaml:01 bug:01 storm:98 2009:98 beginners:01 caml-list:01 caml-list:01 int:01 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 =3D let quoted_elems =3D List.map (fun i -> <:expr< $`int:i$ >>) (Array.to_list arr) in <:expr< [| $Ast.exSem_of_list quoted_elems |]$ >> 2009/10/4 Anastasia Gornostaeva : > Hello. > > The code > > =A0 =A0 =A0 let pl =3D > =A0 =A0 =A0 =A0 =A0 =A0Array.fold_left (fun ls l -> <:expr< $ls$; $`int:l= $ >>) > =A0 =A0 =A0 =A0 =A0 =A0<:expr<>> some_array > =A0 =A0 =A0 =A0 =A0in > =A0 =A0 =A0 =A0 =A0 =A0<: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 >