Questions tagged [literate-programming]

A literate program embeds source code in an essay documenting the program.

Literate programming was introduced by Donald Knuth as an alternative to the structured programming. Literate programming encourages programmers to structure their programs by the flow of their thoughts, i.e., in a way that makes it easy to present and document.

158 questions
1
vote
2 answers

Hide parts of a line from LaTeX output

Is there a way to hide parts of a line from the LaTeX output? For whole lines, this works: \begin{code} foo : Tm Γ t \end{code} \begin{code}[hide] foo = someHiddenDefinitionOfFoo \end{code} but what if I want to hide parts of a line, e.g. parts of…
Cactus
  • 27,075
  • 9
  • 69
  • 149
1
vote
1 answer

How to put bird-style literate Haskell code blocks into a markdown enumeration with pandoc

Normal markdown code blocks can be part of a list: * Item1 * Item 2 ```haskell instance Alternative Facts where … ``` more explanation instance Alternative Syntax where … even more explanation But if I use…
Joachim Breitner
  • 25,395
  • 6
  • 78
  • 139
1
vote
1 answer

ctwill - mini indexes for cweb

where can i download ctwill? The ftp.cs.stanford.edu/pub/ctwill/ site doesn't work for me, either is ftp://labrea.stanford.edu/pub/ctwill/. Thanks, Raoul
Raoul
  • 11
  • 1
1
vote
1 answer

How to compile Knuth's program's?

I am trying to compile one of Donald Knuth's programs http://www-cs-faculty.stanford.edu/~uno/programs/grayspan.w. I am using Ubuntu, I installed Marc van Leeuwen's version of CWEB which uses ctanglex and cweavex, I also installed the Stanford…
1
vote
1 answer

Generate HTML reports from source code

Is there some tool (preferably in Python) that allows you to generate reports in HTML, Markdown or reStructuredText from arbitrary source code (Python, R, Javascript, etc)? The closest thing I have found so far is pyreport that only supports python.…
r_31415
  • 8,752
  • 17
  • 74
  • 121
1
vote
0 answers

How Does One Handle Identical Method Names when Using Literate Programming?

I would like to use a literate programming tool to write a python program. My tool of choice is noweb. My IDE is emacs. The problem I have is that I have classes with identical method names. For example, the python program implements web service…
1
vote
1 answer

Run org-babel-tangle inside Org Src buffer

I was wondering if there is a way to run org-babel-tangle on the parent file when I'm on a Org Src buffer. The workflow is I'm editing a (reStructuredText) source code block in a Org Src buffer, but from time to time I want to export the code…
joon
  • 3,899
  • 1
  • 40
  • 53
1
vote
1 answer

`code' is not defined; perhaps you forgot to include "lhs2TeX.fmt"? When using lhs2TeX

I installed lhs2TeX from Linux Mint 17.1 repositories and get the following error when trying to convert the file. `code' is not defined; perhaps you forgot to include "lhs2TeX.fmt"? Error line reported is first line of code in haskell The calling…
nmiculinic
  • 2,224
  • 3
  • 24
  • 39
1
vote
1 answer

Why does this org-babel c snippet produce no output?

Basically, printf doesn't produce output if I put it in main(). This works: #+begin_src C printf("Hello World!\n"); #+end_src But this #+begin_src C void main() { printf("Hello World!\n"); } #+end_src results in Code block produced no output I…
William Everett
  • 751
  • 1
  • 8
  • 18
1
vote
0 answers

How to use literate coffeescript with rails?

I would expect simply changing the name from "foo.js.coffee" to "foo.js.litcoffee" or "foo.js.coffee.md" to work, but sadly no. There is a sprockets issue. Which suggests I should be able to do this in an initializer: Sprockets.register_engine…
1
vote
1 answer

Pdflatex error when using {-" ... "-} inline TeX comments in lhs2TeX

I have the following code block in my .lhs file which uses inline TeX comments: \begin{code} main = print 0 {-"$\langle$Link$\rangle$"-} \end{code} However, after compiling with lhs2TeX, I get the following errors when compiling the generated .tex…
user1023733
  • 805
  • 5
  • 14
1
vote
3 answers

How to iterate over a changing vector in Matlab, not consecutive number?

I am really a beginner level at matlab. Now I want to have a loop, such that it iterates over a vector (not consecutive numbers) which contains a decreasing number of elements through iteration. For example, I have [1; 2 ;3; 4] (thinking of it as…
ximu
  • 39
  • 1
  • 1
  • 8
1
vote
1 answer

Chunk arguments for noweb

In nuweb, I can do something like this @d Define the chunk with argument echo "Hello, @1"; Then I can use it in other chunks by passing arguments: @d Second chunk @ It will generate the following line: echo…
SPIRiT_1984
  • 2,717
  • 3
  • 29
  • 46
0
votes
2 answers

Macro in Literate programming

I found that some tool such as Noweb doesn't support macro. I want to know what are the advantages and disadvantages of macro in literate programming?
WhatisThat
  • 267
  • 4
  • 10
0
votes
2 answers

Faster alternative methods to for-loop

I have a database with thousands of records. The "for i loop" iteration takes a long time to execute, it is not possible to use it because of the size of the database. I need to perform an iteration where: if row i of x is equal to row i-1 of x…
Carlos
  • 5
  • 2