Hacker News new | ask | show | jobs
by heraclius1729 589 days ago
The fact that you can do stuff like this with a typesetting system has always amused me. Back when I was in grad school for mechanical engineering, some other people in my research group were doing computational mechanics. We would always joke about writing all their simulations in TeX, so that the TeX file for their paper would include all of the simulation code too, and rebuilding the document would run all the simulations and generate the plots.
2 comments

TeX is kind of an unfortunate accident in that respect: Knuth had explicitly set out to make a relatively underpowered macro processor, not a general-purpose programming language; yet at the end he couldn’t help realizing he had, in fact, built a Turing-complete language. (Some parts of appendix D of the TeXbook are much easier to comprehend if you know what continuation passing is.)

When he did set out to build a programming language, Knuth built METAFONT, and it’s just ridiculous how much nicer that is to program—even though it shares with TeX its token-stream-transformer nature and the standard pitfalls of grammarless macroexpanders such as miserable syntax error messages.

But that should be the way it is done rather than be a joke.