Pluto for literate programming

Just realized that Pluto can be turned into a web style literate programming tool with the help of a simple macro. Pluto’s dependency tracking already allows cells to be ordered as the programmer likes instead of what the program flow demands. The missing piece is to name code snippets to be inserted and possibly reused in other places.

macro snippet(name, expr)
    :(macro $(esc(name))() esc($(Expr(:quote, expr))) end)
end

The screenshot below shows (a completely made-up and trivial) example for a literate notebook:

3 Likes