From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0EDD9820A1 for ; Mon, 2 Sep 2013 18:30:16 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of agarwal1975@gmail.com) identity=pra; client-ip=209.85.223.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of agarwal1975@gmail.com designates 209.85.223.176 as permitted sender) identity=mailfrom; client-ip=209.85.223.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f176.google.com) identity=helo; client-ip=209.85.223.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="postmaster@mail-ie0-f176.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AokCAOq7JFLRVd+wlGdsb2JhbABagzxRriKKCIg8gSEIFg4BAQEBBwsLCRIqgiQBAQEDAQECPQEbEgsBAwELBgULGiEhAQEFDAEFAQoSBhMICoddAQMJBgybKYxQgwWECAoZJwMKZIhcAQUMjQOCbAQHhB0DlSxggWmBL4sIAoNEGCmEZCA X-IPAS-Result: AokCAOq7JFLRVd+wlGdsb2JhbABagzxRriKKCIg8gSEIFg4BAQEBBwsLCRIqgiQBAQEDAQECPQEbEgsBAwELBgULGiEhAQEFDAEFAQoSBhMICoddAQMJBgybKYxQgwWECAoZJwMKZIhcAQUMjQOCbAQHhB0DlSxggWmBL4sIAoNEGCmEZCA X-IronPort-AV: E=Sophos;i="4.89,1007,1367964000"; d="scan'208";a="25477390" Received: from mail-ie0-f176.google.com ([209.85.223.176]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Sep 2013 18:30:14 +0200 Received: by mail-ie0-f176.google.com with SMTP id s9so8250373iec.21 for ; Mon, 02 Sep 2013 09:30:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=oiLDUhutHbLMXY1pLsCrmlENC8Pthl/Hm9tq6HAxzbk=; b=IVkGQq0TcdxpsafXTinjP8Gug9JFMPU7KBZDPetvlM4j7ih6TtGmBqWdkYCjRL9amp HC288i9tkNpO1uN4MCtu8QnwEAzjDDQ6PqDjBTbLf3oNh8yv5kGToW8PkVg5dxz1p5yp 8Tbk+dvWRy/NZZtGrlXctUHBcru+pXlyW61ihBGGNpklXQOJIVsSC6uc7P7Tf+1E30ix +tn5nLDG6LwZ622lGmqe26KSLZG7SG4GOKegpxB08TxJyr7S2A/qP3x8u7MNqC1V8SJo qHgfqc2qdhEYunxeBCTmzhBVZPO7R116N45rGldnRqW7sEJpGag399DaPXaQK84bNiR2 eWGg== X-Received: by 10.50.9.37 with SMTP id w5mr12680621iga.29.1378139413423; Mon, 02 Sep 2013 09:30:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.27.225 with HTTP; Mon, 2 Sep 2013 09:29:53 -0700 (PDT) In-Reply-To: <5224B137.8070706@gmail.com> References: <5224B137.8070706@gmail.com> From: Ashish Agarwal Date: Mon, 2 Sep 2013 12:29:53 -0400 Message-ID: To: Jonathan Protzenko Cc: Caml List Content-Type: multipart/alternative; boundary=001a11c2ff90302eed04e56916c2 Subject: Re: [Caml-list] Literate (sort-of) programming in OCaml --001a11c2ff90302eed04e56916c2 Content-Type: text/plain; charset=ISO-8859-1 OCaml Labs is developing MPP (Meta Preprocessor) [1]. It will be used in a new implementation of ocaml.org [2], which includes pages like 99 problems [3] that are generated by running ocaml code through the toploop. In case blah = Markdown, please also note the new Markdown library [4]. [1] https://github.com/pw374/MPP-language-blender [2] http://lists.ocaml.org/pipermail/infrastructure/2013-July/000211.html [3] http://ocaml.org/tutorials/99problems.html [4] http://lists.ocaml.org/pipermail/infrastructure/2013-July/000223.html On Mon, Sep 2, 2013 at 11:39 AM, Jonathan Protzenko < jonathan.protzenko@gmail.com> wrote: > Hi, > > I am currently writing a big, mostly textual document in format blah > (blah being of a course a meta-variable). Are there any tools that > would allow me to interleave OCaml code with the contents of my > document? > > More on my use-case. Creating this document requires me to perform > various subtasks, such as: > - write a code snippet in the document, > - put the code snippet in a file, > - call an external program on the file, > - paste the output into the document. > > Naturally, I wish to automate this. I could roll my own set of > commands, and parse them with OCaml, but I would be re-creating a > scripting language, and it seems to me that interleaving OCaml code > within my document would be better. Here's what I have in mind: > > > blah blah blah blah blah blah blah blah blah blah blah blah blah blah > blah blah > blah blah blah blah blah blah blah blah blah blah blah blah blah blah > blah blah > blah ... we thus write the following code ... : > > {% > let code = "" in > output code > %} > > blah blah blah ... after running the command blah ... the output is as > follows ... blah > > {% > let f = write_into_temp_file code in > let s = run_and_read "myprogram" [f] in > output s > %} > > blah blah blah blah blah blah blah blah blah blah blah blah blah blah > blah blah ... > > > Are you aware of any tool that would allow me to achieve this? > > Thanks, > > ~ jonathan > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --001a11c2ff90302eed04e56916c2 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
OCaml Labs is developing MPP (Meta Preprocessor) [1].= It will be used in a new implementation of oc= aml.org [2], which includes pages like 99 problems [3] that are generat= ed by running ocaml code through the toploop. In case blah =3D Markdown, pl= ease also note the new Markdown library [4].

<= div>[2]=A0http://lists.ocaml.org/pipermail/infrastructure/2013-July/= 000211.html



On Mon, Sep 2, 2013 at 11:39 AM, Jonathan Protzenko <jo= nathan.protzenko@gmail.com> wrote:
Hi,

I am currently writing a big, mostly textual document in format blah
(blah being of a course a meta-variable). Are there any tools that
would allow me to interleave OCaml code with the contents of my
document?

More on my use-case. Creating this document requires me to perform
various subtasks, such as:
- write a code snippet in the document,
- put the code snippet in a file,
- call an external program on the file,
- paste the output into the document.

Naturally, I wish to automate this. I could roll my own set of
commands, and parse them with OCaml, but I would be re-creating a
scripting language, and it seems to me that interleaving OCaml code
within my document would be better. Here's what I have in mind:


blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah
blah ... we thus write the following code ... :

{%
=A0 let code =3D "<sample code>" in
=A0 output code
%}

blah blah blah ... after running the command blah ... the output is as
follows ... blah

{%
=A0 let f =3D write_into_temp_file code in
=A0 let s =3D run_and_read "myprogram" [f] in
=A0 output s
%}

blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah ...


Are you aware of any tool that would allow me to achieve this?

Thanks,

~ jonathan

--
Caml-list mailing list. =A0Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--001a11c2ff90302eed04e56916c2--