Skip to content

Instantly share code, notes, and snippets.

@technocrat
Last active June 2, 2023 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save technocrat/14f7d8b203bfca08a4cd92349cc72892 to your computer and use it in GitHub Desktop.
Save technocrat/14f7d8b203bfca08a4cd92349cc72892 to your computer and use it in GitHub Desktop.

Well, slick

I've been dinking around learning Julia, and by way of procrastination I have begun the usual process of setting up an environment in which to do it. Who says men aren't nestbuilders?

I want something to combine notes and code in a literate programming style. There is comment lines, of course, but what if I want to include something with more heft, such as

$g(x) = ln\Bigl[\frac{\pi(x)6}{1 - \pi(x)}\Big] = \beta_0 +\beta_1x$

For that, there's an IDE like RStudio or VSCode plus RMarkdown or Quarto. Or just settle for lightly formatted text and code with jupyter or pluto. But I was having trouble finding the sweet spot. For one thing, CLI and REPL work helps avoid the sin of Premature PrettyPrinting where it's hard to resist seeing how the output is going to look. Back when we passed paper back and forth instead of texts whole forests were felled in aid of printing out documents with each new paragraph just to check if the page breaks have changed. We never do get over kindergarden.

Enter Franklin.jl a Julia static web site generator toolchain that allows interpersing code blocks with markdown text to produce HTML that will display and execute the code blocks, including plots. Just like

using LinearAlgebra, Random
Random.seed!(555)
a = randn(5)
round(norm(a), sigdigits=4)

And the following text line

\show{snippet1}

will cause the return from the code block to be printed.

So, with lvim (nvim with a lot of scruff hidden out of sight) on half the screen and a Julia REPL on the other half, I can go type, type $\dots$ on one side and a prompt on the other: julia >.

If I get the DTs, I can always regenerate the page and fire up the server or maybe it has a watch() daemon I haven't discovered yet.

Think I'll like it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment