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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9C07E820A1 for ; Mon, 2 Sep 2013 17:42:41 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jonathan.protzenko@gmail.com) identity=pra; client-ip=209.85.214.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="jonathan.protzenko@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jonathan.protzenko@gmail.com designates 209.85.214.43 as permitted sender) identity=mailfrom; client-ip=209.85.214.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="jonathan.protzenko@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f43.google.com) identity=helo; client-ip=209.85.214.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="postmaster@mail-bk0-f43.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsBAF2xJFLRVdYrk2dsb2JhbABahzS+aBYOAQEBAQcLCwkUBCSCTh0BGxwCAxIQDwIFFgsCCwMCAQIBEREBBQEvCAEBh2sBAw+YPYMAi39RgwWEBgoZJw1kiFwBBQyBHY5zglOBNAOXdYYsiVFBhEo X-IPAS-Result: ArsBAF2xJFLRVdYrk2dsb2JhbABahzS+aBYOAQEBAQcLCwkUBCSCTh0BGxwCAxIQDwIFFgsCCwMCAQIBEREBBQEvCAEBh2sBAw+YPYMAi39RgwWEBgoZJw1kiFwBBQyBHY5zglOBNAOXdYYsiVFBhEo X-IronPort-AV: E=Sophos;i="4.89,1007,1367964000"; d="scan'208";a="31205186" Received: from mail-bk0-f43.google.com ([209.85.214.43]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 02 Sep 2013 17:42:40 +0200 Received: by mail-bk0-f43.google.com with SMTP id mz13so1656652bkb.16 for ; Mon, 02 Sep 2013 08:42:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=moUpMuCdz7jdCpGeMPyEv6//km3bZqtNeTCWrbCCMYY=; b=y6XsNSNQ9U2jSCWKMIro52OQMrAV0zhiy9gSpWSHDzVoPMU0QCnHHB+OHLj8bTTYfz VlO54dq0Q5luqqFvWryBiMFNMm8N9ZRjDV3FDLopSpiK6SKxv4fZOV25qXO1b//X1obI bm5YgcW79JNOfhGt4hoNNoLTiZZI3Gx40iYI1T7F4/CoLgFv348CziXvFX3egMZxrvf2 +Mop3PYCQL9fEXHfIth2mYgts5rCYpHUZvQ0iHfvTX12RYA82RqMvWlt0hyqOVxUG2+c l7ZrxiOVdkoPQKaBCoEqyCnhezDZFvlXiCAiSJIPdpbrvk1dZVB69ZKtktFx1vvtabLQ czbw== X-Received: by 10.205.14.197 with SMTP id pr5mr2632414bkb.25.1378136560700; Mon, 02 Sep 2013 08:42:40 -0700 (PDT) Received: from [128.93.11.91] (sauternes.inria.fr. [128.93.11.91]) by mx.google.com with ESMTPSA id qe6sm3033820bkb.5.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Sep 2013 08:42:39 -0700 (PDT) Message-ID: <5224B137.8070706@gmail.com> Date: Mon, 02 Sep 2013 17:39:35 +0200 From: Jonathan Protzenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Thunderbird/26.0a1 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Caml-list] Literate (sort-of) programming in OCaml 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