Prototyping with Pluto.jl

julia
pluto
Published

December 1, 2022

The data I use for the English-German translations in Foreign Dispatch comes from Wiktionary, in the form of a SQLite database made available by WikDict. The structure of the data is fairly complicated, and I needed a way to explore the database, beyond manually running queries in a REPL. I recently started using Pluto.jl, a notebook for the Julia programming language, and realized it would be a good fit for exploring the database.

What sets Pluto apart from other notebooks, such as Jupyter, is the reactivity. Pluto builds a dependency graphs of the code cells, and when you change a cell, any other cells that depend on the value of that cell will automatically update. The result is a highly interactive environment, where programming suddenly feels fluid, with a near-instant feedback loop.

This is what my exploratory notebook looks like:

Exploratory notebook in Pluto

It contains four cells:

  1. The first cell contains the packages I need1.
  2. The second cell loads the database and assigns it to a variable.
  3. The third cell executes a query, interpolating the value of the variable query, and turns the result into a DataFrame, which is visualized as a table in Pluto.
  4. The fourth cell binds the value of the variable query to an HTML input field.

When I change the text in the input field, the cell running the query is instantly refreshed:

Effectively, I have built a fully interactive prototype in very short time.

If Pluto seems interesting to you, I can recommend working your way through the MIT course Introduction to Computational Thinking, which uses Pluto to teach things such as image manipulation in a highly interactive way.

Footnotes

  1. Pluto has a built-in package manager.↩︎