The PLT Scheme mechanism mentioned above is a good idea
but it has a niche quality to it.

Latex is an industry standard publication language. Many
books and technical papers, especially in mathematics,
use it. Some conferences require it. All publishers support
it and it is widely used.

Traditional literate programming uses two functions
 weave foo -- extract the latex document from foo
tangle foo -- extract the source code from foo

The weave function looks for special markers in the source
code. In "noweb" it looks for <<any string>>= to mark the
definition and <<any string>> to mark the use. It turns out
that it is trivial to write latex macros to set these
boundaries, e.g.

\begin{chunk}{any string}
\end{chunk}

marks the definition of code and

\thechunk{any string}

marks the use of code.

Using the above macros you no longer need the 'weave'
function.

So what about tangle? Well, the tangle function just looks
for the code chunk definitions and stores them in a hash
table indexed by "any string". The code is extracted from
the hash table when requested by 'thechunk' markers. So it
is trivial to write a lisp function TANGLE to scan 'foo'
and output the source.

Thus you can write straight latex files, surround your code
with standard latex syntax, and run a trivial lisp function
to extract your code. Latex file markup is very similar to
html markup but wildly more powerful.

Bingo, you have literate programming with no external tools at all.

I can supply the latex macros and the (common)-lisp code to
implement the above techniques.

Tim Daly

Tassilo Horn wrote:
On Wednesday 21 July 2010 06:32:02 Mark Engelberg wrote:

Hi Mark,

I would definitely welcome a literate Clojure tool.

You might want to have a look at Emacs' org-mode [1].  It has a facility
called Babel [2] that allows for literate programming in all the
languages listed at [3], Clojure being one of them, and support for new
languages is being added frequently.

Currently it is moved from the contribution directory to the org core,
and the documentation is being updated or written at all.

Bye,
Tassilo
__________
[1] http://orgmode.org/
[2] 
http://orgmode.org/manual/Working-With-Source-Code.html#Working-With-Source-Code
[3] http://orgmode.org/manual/Languages.html#Languages


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to