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
0
votes
1 answer

ctwill - mini indexes for cweb (again)

I am looking for ctwill's (literate) source code. I did not find it in CTAN or through Knuth's page. The links in this previous question (ftp://ftp.cs.stanford.edu/pub/ctwill/ and ftp://labrea.stanford.edu/pub/ctwill/) don't seem to work. (And the…
Tássio
  • 111
  • 4
0
votes
1 answer

How is the order of execution of code chunks in a Literate Programming tool like noweb or Rmarkdown determined?

I am reading this and it says : Because of the way notangle extracts and assembles its input, the program can be presented and explained in the best order for human understanding. notangle will make sure that the program chunks are in the right…
user2338823
  • 501
  • 1
  • 3
  • 16
0
votes
1 answer

How to iterate over a Map in batches in javascript?

I have this on a map. Could you please help how can I read this in a batch of 2 and call a process. { ids: [ {id: 1, value: 'abc'}, {id: 2, value: 'abcd'}, {id: 3, value: 'xyz'}, {id: 4, value: 'foo'}, {id: 5, value: 'bar'}, …
rigisa
  • 13
  • 5
0
votes
2 answers

Iterate function over a list

I have a list in which total number of items may change. I want to apply a function which requires two inputs on first two items in the list and with the result I want to apply the same function on the third item in the list and with the result I…
Moca
  • 25
  • 1
  • 4
0
votes
1 answer

literate haskell - Type error in application

Here is my code: > newtype IN_0 = IN_0 Integer deriving Show > nminus :: IN_0 -> IN_0 -> IN_0 > nminus (IN_0 z) (IN_0 z') > | z >= 0 && z' >= 0 = IN_0 $ maximum(0,z-z') > | otherwise = IN_0 0 When I compile this in ghci it compiles…
cheshire
  • 1,109
  • 3
  • 15
  • 37
0
votes
2 answers

Bookdown: Cross-reference figure in another file

I have taken the plunge and am preparing a manuscript for publication entirely in RStudio using bookdown. In the main text I would like to cross-reference figures in a separate supporting information .Rmd file. Let's say this is my main text file…
0
votes
2 answers

Formatting (beautifying) code blocks inside makdown documents when using Atom

I’m beginning to explore literate programming, which involves embedding executable code blocks into markdown documents. My current working environment is Atom with a package called markdown-preview-enhanced – it supports live code chunk execution,…
0
votes
1 answer

How to find match to given variable and assigning while 2D array iteration?

I have an array of the bellow style (2D) (just a dummy set of data); int array [][]= {{1.0, 20.0}, {2.0, 40.0}, {3.0, 60.0}, {4.0, 80.0}} I have in my program another variable double v = 3.2; I…
0
votes
1 answer

Python: How to get values and not object type while iterating through pandas Data Frame?

I am trying to fetch values of each row of pandas dataframe using below code. points = [ makePoint(row) for row in df.iterrows() ] here df has 4 column. each contains integer data. while i try to print row, it returns follow, 1 3 2 3 3 4 4…
Code_Art
  • 111
  • 1
  • 1
  • 9
0
votes
2 answers

Wysywig literate programming (or viewing generated documentation on-the-fly)

I use a lot of illustrations, diagrams and equations to document C++ and python codes, and a way to do this is to inline them with doxygen. The problem is that, when coding, they are not directly available in the code (unless I use ascii-art for…
0
votes
3 answers

Python - Convert String into Iterable Integer List

I am developing a Twitch Python IRC Bot that has a currency system. The balances of users are stored in a list, which is loaded from and saved to a text file. However, because the text file's content is loading into one singular string that is then…
lucap
  • 83
  • 2
  • 10
0
votes
1 answer

Keeping uninteresting code accessible through scrolling

If I process the following asciidoc file with asciidoctor, Here is our first program: [source,cpp] ---- // Uninteresting/Potboiler line // Uninteresting/Potboiler line // Uninteresting/Potboiler line // Uninteresting/Potboiler line // Interesting…
Calaf
  • 10,113
  • 15
  • 57
  • 120
0
votes
1 answer

Literate PHP to test examples in README

I'd like to include the examples from my README.md in my testsuite. So I can be sure that all examples still work and I don't need to write the same examples again as PHPUnit test cases. Has anybody already written support for this?
Thomas Koch
  • 2,833
  • 2
  • 28
  • 36
0
votes
1 answer

Write coffeescript cake file in literate coffee

I would like to write a Cakefile in litcoffee (as in Cakefile.litcoffee), is there a way to do that?
Dinis Cruz
  • 4,161
  • 2
  • 31
  • 49
0
votes
1 answer

Using the richness of syntax highlighting produced by asciidoctor

Asciidoctor will process the file simple.adoc containing: :source-highlighter: pygments [source,java] Foo bar = baz + qux; using pygments to produce many syntax categories We can confirm that the HTML produced is indeed quite rich:
Calaf
  • 10,113
  • 15
  • 57
  • 120
1 2 3
10
11