Being able to see the code that generates certain tables in my older documentation really helps me to more quickly remember and use stuff I did months or years ago.
Example: The command to get a list of S3 buckets that have a particular attribute set. The command to do that might not make much sense by itself (say in a history grep) but with extra text describing what and why, I understand it faster.
Although it is nice also to show off my Emacs setup during a screen share to a couple dozen people who don't know what it is. They treat the org-mode headlines, rearranging, todo items, schedules, etc, as some sort of magic. Org-babel with the results in a simple table kinda blew their minds. The number of project managers who want "my emacs setup" created for themselves was kinda funny, since they're all normally so focused on Microsoft Project or Jira.
Basically, tables rock, especially when you can use rectangle commands to copy and paste kerning values between classes you have to split up, and generating a test webpage programmatically is fun too. :D
Thinking about it, is Jupyter Notebooks (and the like) a form of literate programming?
Thinking even more about it, I think I actually used (or tried to) literate programming in a course about Machine Learning using R and – if I remember correctly – LaTeX to generate the actual application and a PDF.
Here's an example emacs configuration:
(use-package jupyter
:after org
:config
(org-babel-do-load-languages 'org-babel-load-languages '((jupyter . t)))
;; default args for jupyter-python
(setq org-babel-default-header-args:jupyter-python
'((:results . "replace")
(:async . "yes")
(:session . "py")
(:kernel . "python3"))))
After that, you could execute jupyter code block (Org Babel): #+begin_src jupyter-python
1+1
#+end_src
#+RESULTS:
: 2
You can use latex in org-mode, generate pictures, get nice git diff, export it to pdf, etc.Essentially a good implementation of Python code blocks would reimplement half of Jupyter anyway.
We don’t use the term “literate programming” much anymore, the concept of “reproducible reports” resonates much more with R users. But the experience is much the same.
(Disclosure: employed at RStudio)
It sounds silly, but when there’s a lot of work do in terms of writing the literature part, and then adding the actual code part, I’m much happier with vim than I am with the browser based editor.
(This is for producing literate programs for the purpose of teaching others, not for my own benefit.)
Most of my Jupyter notebooks are just code, but I've got some with long Latex mathematical derivations of formulas that appear in the code. I would actually like to be able to have that kind of thing in comments within the code itself. I don't do literate programming really though.
In Org Mode, you get all the syntax highlightings and keybindings for whatever language's mode if you do literate programming with it.
What you won't get are things like being able to integrate your compilation failures, etc. As an example, if you write something that fails to compile, Emacs will not quickly be able to take you to the line that caused the failure. Similarly, things like linting, etc typically break.
Frustratingly, if you get an exception (e.g. "KeyError" in Python), it will not show the result of any print statements, so debugging is a bit painful.
I'm sure someone can solve these problems, but I don't know that anyone has.
https://github.com/jingtaozf/literate-clojure
but ran into this
https://github.com/polymode/poly-org/issues/20
Either some IDE like functionality doesn't work or syntax highlighting doesn't work after you go through additional complexity compared to simply starting a project.
https://raw.githubusercontent.com/sachac/sachac-hand/master/...
The point (and the difference to just thoroughly commenting your code) is that you have one source file that equally serves as the basis for generating the actual program as well as its documentation. The link above shows the raw file, github renders it nicely if you go to the main page of the repository.
[1] https://en.wikipedia.org/wiki/Literate_programming
[2] https://orgmode.org/