From: Francis Sergeraert
Subject: Does there exist a lisp-webb ?
Date:
Message-ID: <CJzEEo.5n9@imag.fr>
Does there exist something like a Lisp-webb, that is, something
allowing one to mix Lisp-code and (La)TeX-documentation. A Lisp-webb
file should be able to product:
1) ordinary source Lisp files.
2) (La)TeX-files containing the Lisp codes and convenient TeX-style
comments.
This seems easier for Lisp than for Pascal because of the usual
structure of Lisp files (long list of small functions).
--
Bien cordialement. Francis Sergeraert.
LMC, 46, av. Fe'lix Viallet, F-38031 Grenoble Cedex. Tel=(33)7657.4872.
Inst. Fourier, BP 74, F-38402 St Martin d'He`res Cedex. Tel=(33)7651.4833.
In article <··········@imag.fr> ········@imag.fr (Francis Sergeraert) writes:
> Does there exist something like a Lisp-webb, that is, something
> allowing one to mix Lisp-code and (La)TeX-documentation. ...
Check out Ramsdell's SchemeWEB (any Lisp + LaTeX) and the language-
independent WEBs (FunnelWeb, NUWEB, noweb, etc.). You can get details
from the comp.programming.literate FAQ, available from both CTAN and
the Literate Programming Archive at ftp.th-darmstadt.de, also by
sending a one-line email message saying
SENDME FAQ.FWEB
to ········@shsu.bitnet.
IMHO, none of these are much good during development, but thy do make
for nice documentation of the end product.
-- rar
A recent (well, not so recent any more) issue of Lisp Pointers has
an article on literate programming in Scheme. I've seen similar
things before and thought I should point out a very easy way to do
literate programming in lisp. Here's a close approximation to what
I've been doing for several years now. I sent this to lisp pointers
but haven't heard anything.
Title: Literate programming in lisp - trivially
This article shows how to get the benefits of so-called ``literate
programming'' for lisp at almost no cost. The programmer maintains
lisp source files as before, but follows these simple conventions:
- Text to be formatted as usual by latex appears in extended comments
(delimited by number-bar and bar-number), while the rest is treated as
lisp source to be typeset verbatim.
- The source file must begin and end with extended comments (of course
these may be empty).
This does impose a very minor additional constraint on the source.
The balanced comment delimiters must appear just in the places where
it has the intended meaning. For instance, if the code contains
something like
(print "#|")
the embedded comment delimiter will have unfortunate consequences in
the latex output. Of course, the latex sections should make sense to
latex.
In order to transform the lisp source file into latex source, do the
following:
- delete the balanced comment delimiters at the top and bottom of the file
- replace every remaining bar-number by ``\begin{verbatim}'',
and every remaining number-bar by ``\end{verbatim}''.
- add a standard prologue and epilogue. Here's a minimal example:
prologue:
\documentstyle{article}
\begin{document}
epilogue:
\end{document}
Actually I tend to leave out the last step, and instead include the
resulting file (or several of them) from another file.
Clearly this scheme could be made to work just as well for other
document processing systems. I expect that every programmer who tries
it will at least experiment with the following obvious extensions:
- automate the transformation of lisp source into latex source
- make the code formatting environment smarter than verbatim
- add other useful macros to the standard prologue
- provide a way to reorder code in the latex output - lisp compilers
require macros to appear in the source before they're used, whereas
one might like to explain them later. This can be done by embedding
the text to be delayed in the definition of a tex macro and calling
that macro where you want the text to appear.
--
Don Cohen
From: Kaelin Colclasure
Subject: Re: Does there exist a lisp-webb ?
Date:
Message-ID: <1809@racerx.bridge.COM>
Francis Sergeraert (········@imag.fr) wrote:
: Does there exist something like a Lisp-webb, that is, something
: allowing one to mix Lisp-code and (La)TeX-documentation. A Lisp-webb
: file should be able to product:
: 1) ordinary source Lisp files.
: 2) (La)TeX-files containing the Lisp codes and convenient TeX-style
: comments.
: This seems easier for Lisp than for Pascal because of the usual
: structure of Lisp files (long list of small functions).
I have been quite pleased with noweb, a language-independent literate
programming tool written by Norman Ramsey. It can be obtained from the
Literate Programming Archives at any of the following FTP sites:
ftp.th-darmstadt.de [130.83.55.75]
ftp.TeX.ac.UK [134.151.79.32]
ftp.Uni-Stuttgart.DE [129.69.8.13]
ftp.SHSU.edu [192.92.115.10]
In addition, the Literate Programming FAQ lists a number of other
alternatives, both language-independent and Lisp-specific. Try news.answers
or request a copy via EMail to ········@shsu.edu with "sendme litprog.faq"
as the text of the message (no quotes, of course).
--
// Kaelin Colclasure ---------------------------------------------------------
// EMail: ······@bridge.com Mail: Bridge Information Systems, Inc.
// Voice: (314)567-8463 717 Office Parkway
// Fax: (314)432-5391 St. Louis, MO 63141