texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Literate Programming in TeXmacs?


From: Ralf Hemmecke
Subject: Re: [Texmacs-dev] Literate Programming in TeXmacs?
Date: Tue, 22 May 2007 01:54:12 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070326)

On 05/21/2007 10:20 PM, Todd Wilson wrote:
Felix Breuer wrote:
A simple implementation that serves both purposes might look as
follows. Suppose snippets of code in the document are wrapped in an
environment like

  <lp-code|label|body>

where label is an arbitrary string that marks which snippets belong
together and body is an arbitrary TeXmacs tree that is "the code".

A slightly more general but useful extension of this would be to use two labels, one for "import" and one for "export". This would allow you to have multiple files/sessions that shared initial segments (i.e., file/session trees). For example,

    <lp-code||common|body0>
    <lp-code|common|branch1|body1>
    <lp-code|common|branch2|body2>

would create two files/sessions with bodies body0+body1 and body0+body2. This would be more in line with languages that have the means to do #include's, and would also make possible a kind of "exploratory" session, where different approaches to the main line can be highlighted and developed without interfering with the main-line development.

Todd Wilson

Let me translate what you want into noweb syntax.

%---BEGIN file.nw
blah blah blah

<<my imports>>=
some import statements go here
@

more blah blah

<<foo>>=
<<my imports>>
more code
@

even more blah blah

<<bar>>=
<<my imports>>
some other code
@

%---END file.nw

Here is what you get if you use notangle.

>notangle -Rfoo file.nw
some import statements go here
more code
>notangle -Rbar file.nw
some import statements go here
some other code
>


Do you see the difference to your two argument "lp-code"? Or am I missing your point?

Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]