Making science reproducible @nextjournal
⚡️ Lightning Demo
Nextjournal is a hosted notebook platform for literate programming.
Goals:
better way to present ideas compared to status quo (PDFs)
run existing code: not learn a new language
reproducibility: apply immutability to document, data and environment (docker image) to make sure things keep running
🌈 Standard Notebooks features
randn(5)
0.4s
Julia
5-element Array{Float64,1}:
0.390714
0.376106
-0.865263
-0.492898
0.201777
library(ggplot2)
theme_set(theme_classic())
# Histogram on a Continuous (Numeric) Variable
g <- ggplot(mpg, aes(displ)) + scale_fill_brewer(palette = "Spectral")
g + geom_histogram(aes(fill=class), binwidth = .1, col="black", size=.1) +
labs(title="Histogram with Auto Binning",
subtitle="Engine Displacement across Vehicle Classes")
0.6s
R
🗃 Passing Data
Polyglot cells can exchange data by writing to a /results
folder.
with open("/results/wave.txt", 'w') as f:
f.write("Hello Future of Coding 👋")
0.3s
Python
empty
Then other cells can access it.
ls NJ__REF_
0.8s
Bash
🥾 Custom Components & API
Work-in-progress: extensibility via in-browser runtimes:
(def turtles (reagent.core/atom []))
ClojureScript
→
^{:nextjournal/viewer :reagent}
#(into [:div] (map (fn [s] [:span {:style {:font-size s}} "🐢"])) @turtles)
ClojureScript
→
(dotimes [_ 10]
(swap! turtles conj (/ (or (last @turtles) 130) 1.2)))
ClojureScript
→
Can also add missing functionality, e.g. clear outputs:
(and (swap! re-frame.db/app-db update-in [:article :nodes]
#(reduce-kv (fn [m k v]
(assoc m k (dissoc v :outputs))) {} %)) :clear!)
ClojureScript
→
:clear!
✨ More
realtime collaboration
on demand provisioning with powerful machines + GPUs
automatic versioning
remix existing notebooks