4 ms·
Using LP, comments can be arbitrarily formatted, with TeX equation handling, beautiful figures, tables, cross references, indices, table of contents, etc. Code
by prestonbriggs 11y ago
Using LP, comments can be arbitrarily formatted, with TeX equation handling, beautiful figures, tables, cross references, indices, table of contents, etc.
Code can be presented in a way that best suits the reader (versus the writer or the compiler). Though Knuth's examples usually seem to dive right in, lacking the introduction to be provided by the latest stuff in TAOCP.
When I use it, I write it like a paper decorated with code, where the code can be extracted and run. I usually include the necessary make file and perhaps some test data. Entries in figures/tables are sometimes generated automatically by the program being described.
There are lots of old papers and critiques about LP, by Knuth and others. You should check 'em out.
- a_e_k 11y agoAs a fairly modern example, let me suggest "Physically Based Rendering" by Pharr and Humphreys [1]. It is a complete (and fairly large) book in the LP style. There are couple of sample chapters available online that you can view [2][3]. To me, one of the real advantages is that you can present the code and commentary in a logical structure that goes in an orderly progression of concepts for human understanding rather than the more strictly physical structure that a compiler expects. [1] http://www.pbrt.org/ http://www.pbrt.org/ [2] http://www.pbrt.org/chapters/pbrt_chapter7.pdf http://www.pbrt.org/chapters/pbrt_chapter7.pdf [3] http://www.pbrt.org/chapters/pbrt-2ed-chap4.pdf http://www.pbrt.org/chapters/pbrt-2ed-chap4.pdf