http://literateprogramming.com/
I use it in a current project using LaTeX:
The project seems to be specifically targeting working scientists, but I think there's real potential for using mathematical and math-like notation in a general programming language. The array language family does adopt a few of the affordances from math, and even that partial pick-up gives them some ergonomic features not seen elsewhere.
At the moment, we're kind of stuck in the paradigm of linear input, only using very limited typography for somewhat dumb syntax highlighting. Math-like notation is really nice at conveying semantics and intent in ways that are really challenging in current languages. For example, sub- and superscripts effectively act as function parameters but give extra freedom for conveying the different meaning and use of said parameters. Things like Haskell's generic infix syntax, named parameters, optional arguments, etc. can be seen as ways of trying to work around current limitations.
The biggest question for me is input, which Forscape seems to address quite nicely. We don't just want to typeset our code prettily, we want to have all the affordances of advanced typography directly available as we code.
I'd love to hear user stories from Forscape: Do you like the mouse-oriented editor experience or do you prefer keyboard shortcuts? What is easiest for you to express in Forscape the language? What is most challenging? Where does the system diverge most from the natural expression? For those with a programming or CS background, how easy is it to reason about memory access and execution? Etc.
Thanks for sharing!
[1] https://github.com/WillAdams/gcodepreview/blob/main/gcodepre...
One particularly nice thing about it is that it's completely optional sugar over a lispy "FullForm" syntax, and it's easy to convert between the two.
I'd encourage everyone to play with it, but it's sadly non-free.
If you know of a better LaTeX package to use, or better settings for Python or languages like OpenSCAD I'd be glad of them.
Mostly I need the LP stuff for managing multiple files, and the overview of the PDF and hyperlinked ToC and Index and so forth.
Those slides are my introduction to Fortress. Sounds nice, sorry to hear it's discontinued. I'm struck by how very similar to Julia it is (which is officially inspired by Fortress), for example the focus on performance and maths, zero-cost abstractions, type specialisation, very similar syntax, ASCII<->Unicode equivalence, encouragement of unicode identifiers and operators, and some (small) amount of eliding '*' for multiplication. (You can write "2(a + 1)a^2" but not "(a+1)(a+2)" because the latter is a function call. Whitespace between multiplicands not allowed.)
It seems it would be easy to write a package to display Julia code as HTML or Latex, although I didn't find one. There's already a library to print expressions as Latex, and of course in a Jupyter notebook results are displayed in HTML.
TFA makes me really like the idea of literate papers, with math, code, and data embedded in the paper.
So then you have two options:
- compile the typeset equation to code
- hand-code the equation
Forscape is a third option, perhaps more akin to a Jupyter-style notebook, where you write equations and text but you can "run" those equations. Literate programming isn't quite this, not unless you automatically get codegen from your equations.Basically we need to marry LyX and Jupyter.
https://github.com/WillAdams/gcodepreview/blob/main/literati...
(with a bit of help from folks on tex.stackexchange.com: https://tex.stackexchange.com/questions/722886/how-to-write-... )
could be used for that --- you'd just need to execute the code once it is written out, then read the files in once they have been made.
you could get Wolfram engine for free (use your home e-mail address) which is basically text io single seat Mathematica.
Then you download WLJS notebook interface and voila, you all set...
Not exactly wysiwyg typeset coding, but a close concept, compiling relatively more legible equations to code
(And I'd love to rewrite my simulation code with something like forscape, because then the math code would appear as such and not as a mubojumbo of numpy operations)...