My new #plt class asks that we send our code in as a pdf, so I'm experimenting with #literateprogramming , and it's pretty fun to learn #tex at the same time.
I started with some literate #haskell but decided to switch to a more language agnostic solution as we will also be using #c , #rust and #scheme.
So right now I'm directly writing #tex documents in #acme , with haskell interspersed through the documents, I'm counting on extracting the haskell code with awk or sam and piping it to ghc.
@mathuin why not some tool that was specifically written for literate programming, like noweb?
@grainloom Too lazy to port it to openbsd
And a little yak-shaving never hurt a man
@grainloom I shared an example of what I did to the rest of my class here:
https://github.com/Superpat/ulit
It's reeeeeal simple.
@mathuin Put the haskell code inside latex comments, prepend the code with > and tell ghc that it's aliteral haskell file :)
@ckeen Yeah i know that would work, but sort of wanted to try a solution that would work with many different languages.
@mathuin Org-mode's babel maybe :)
@ckeen You mean leave Acme? Haha but yeah org-mode could be an idea.
@mathuin I have tried several literate programming tooling over the years and most are meh...
The original one forces you to chunk out your code funnily and in the end forces you to latex, so now you have two problems all of a sudden.
Something lightweight like literal haskell files have been the most practical.
I think if you don't need chunking you can get away with an arbitrary code marker and an awk script to weave your literate file into a source file.
@ckeen Latex is already a requirement of the course I'm taking, so thats moot.
And yes, I've been getting away with an awk script for now.
@mathuin One could call emacs in batch mode from ACME too :)
@mathuin You don't need an extra pipe but can run ghc and LaTeX on the same files: use \begin{code} and \end{code}, name the files .lhs and then \include or \input them in main.tex.
Here is a bigger example I made for a course last year: https://github.com/funcspec/report-example
I have spent some time researching literate programming solutions and while there is a lot of language specific solutions, there arent many language-agnostic ones.
https://www.cs.tufts.edu/~nr/noweb/
#noweb does not seem actively developed and does not have a package on #openbsd my naive attempt at compiling it did not go well.
https://github.com/zyedidia/Literate
#Literate is interesting, but as far as I know, there's no way to run #D programs on openbsd yet.