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 75E80820A1 for ; Mon, 2 Sep 2013 17:55:48 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=193.252.23.210; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=193.252.23.210; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@msa.smtpout.orange.fr) identity=helo; client-ip=193.252.23.210; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@msa.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYAALazJFLB/BfSkGdsb2JhbABahzS6TIJzgT8OAQEBAQkUCRclgiQBAQUjFUARCxgCAgUWCwICCQMCAQIBRQYBDAgBAYgCpzyReIEpjl2CaYE0A5d1hiyOXA X-IPAS-Result: ArYAALazJFLB/BfSkGdsb2JhbABahzS6TIJzgT8OAQEBAQkUCRclgiQBAQUjFUARCxgCAgUWCwICCQMCAQIBRQYBDAgBAYgCpzyReIEpjl2CaYE0A5d1hiyOXA X-IronPort-AV: E=Sophos;i="4.89,1007,1367964000"; d="scan'208";a="31207131" Received: from msa01.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.210]) by mail2-smtp-roc.national.inria.fr with ESMTP; 02 Sep 2013 17:55:47 +0200 Received: from [192.168.1.118] ([92.151.8.47]) by mwinf5d55 with ME id LFvn1m00A10tCGU03FvnHA; Mon, 02 Sep 2013 17:55:47 +0200 Message-ID: <5224B504.1080709@frisch.fr> Date: Mon, 02 Sep 2013 17:55:48 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Jonathan Protzenko , caml-list@inria.fr References: <5224B137.8070706@gmail.com> In-Reply-To: <5224B137.8070706@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Literate (sort-of) programming in OCaml On 09/02/2013 05:39 PM, Jonathan Protzenko wrote: > 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 ... I'm sure you can use sed to (I use '' for meta quotes): - Add ''print_string"'' in front of the file and ''";;'' at the end. - Replace ''{%'' with ''";;'' and ''%}'' with ''";; print_string"'' If you apply this transformation and call the toplevel on the result, you should get what you want, no? -- Alain