A static-page Clojure(Script) playground for Sussman & Wisdom's Structure and Interpretation of Classical Mechanics. Emmy (computer algebra), Mafs (2D plots), MathBox (3D plots) and emmy-viewers all in the browser via Scittle — no install required.
Live: https://bathro.be/bemmy/
Writeup: https://inwordsandpictures.com/bemmy/
Prerequisites:
- Babashka (
bb) — runs the build/serve tasks - Node.js 18+ — the translator tests and the CodeMirror dep-graph vendor walker
Clone and run:
git clone https://github.com/dxnn/bemmy
cd bemmy
bb dev # watch + serve at http://localhost:1341Tasks (see bb.edn):
bb release # advanced-compiled plugin build (writes public/js/)
bb serve # serve public/ at :1341
bb dev # watch + serve in parallel
bb test # sicm2emmy translator tests (node --test)
bin/vendor.sh # refresh public/vendor/ from CDNs
# (rare; only when bumping versions)- Edit
src/orpublic/app.cljs. - Run
bb releaseifsrc/changed (plugin rebuild). Plain text changes topublic/app.cljsneed only a browser reload. - Browser at http://localhost:1341 — try the system pages (Welcome / SICM / Graphics / 3D).
public/— the static site; drop into any static host.index.html,app.cljs(the playground UI, evaluated by Scittle),sicm2emmy.js(Scheme → Emmy translator), neonic logo bundle.js/— built plugin bundle. Regenerated bybb release. Gitignored.vendor/— local copies of CDN deps (KaTeX, Mafs, hljs, React UMD, CodeMirror 6 + transitive). Tracked.
src/scittle/emmy.cljs+src/scittle_plugin.edn— plugin source + manifest fed to scittle.build.test/sicm2emmy.test.js— translator tests (node --test).bin/vendor.sh— refreshespublic/vendor/. Invokesbin/vendor-cm.mjsfor the CodeMirror dep-graph walk.
public/ is the entire deploy target. After bb release, copy or
sync public/ to any static host.
- SICM — Sussman & Wisdom's Structure and Interpretation of Classical Mechanics
- Emmy — Clojure(Script) computer algebra
- emmy-viewers — visualization helpers for Emmy
- mafs.cljs / mathbox.cljs / leva.cljs — Clojure(Script) wrappers around Mafs (2D), MathBox (3D) and Leva (control panels)
- Scittle — runs the page, built on SCI
- Babashka — drives the build/serve tasks
- Reagent on React
- CodeMirror 6 with @nextjournal/clojure-mode
- KaTeX — TeX math rendering
- highlight.js — code highlighting
- Three.js — used by MathBox