Hello! Welcome to the repository for my (Sam Ritchie's) talks from the 2022
European Lisp Symposium and <programming>
conferences.
If you find this work interesting, please consider sponsoring it via Github Sponsors. Thank you!
Here you'll find:
- More information about SICMUtils and the projects I discussed in the talks
- Working versions of the demos
- The
org-re-reveal
-generated slides from the presentations.
- SICMUtils repository
- The Road to Reality Newsletter
- Road to Reality Discord Server
- Clerk, the notebook rendering engine used by SICMUtils
- In-progress executable version of Functional Differential Geometry (book link)
- In-progress executable version of Sussman and Wisdom's Structure and Interpretation of Classical Mechanics (book link)
- Mathbox by @unconed
- mathbox-react by @ChristopherChudzicki
The demos include both Clojure and Clojurescript code. Two environments means two build tools, so you'll need to have these installed:
- clj, for running the JVM side
- shadow-cljs
for building the JS bundle used by the demos. This is a lovely system that
will automatically rebuild the bundle any time you save a cljs file.
- You'll also need node.js
installed, to install the initial
npm
dependencies.
- You'll also need node.js
installed, to install the initial
When those are all set (the links include installation instructions),
Clone the repository:
git clone [email protected]:sritchie/programming-2022.git
cd programming-2022
Generate the JS bundle for the demos by running the following commands in one terminal window:
npm install
shadow-cljs watch sicm-browser
In another tab, start a Clojure repl with clj
. This REPL has the full
SICMUtils
API
available, so run some tests for fun:
(->infix (((exp D) (literal-function 'f)) 'x))
;;=> "f(x) + Df(x) + 1/2 D²f(x) + 1/6 D³f(x) + ..."
Next, start a webserver for Clerk, (the literate programming viewer) by running the following commands:
;; point Clerk at our newly-generated JS bundle instead of its default:
(swap! clerk-config/!resource->url
assoc
"/js/viewer.js"
"http://localhost:9000/out/main.js")
;; Start the clerk server.
(clerk/serve!
{:browse? true :port 7777})
Now run (clerk/show! <path/to/file.clj>)
to run any of the demos. Some
examples to try:
;; intro:
(clerk/show! "src/demo.clj")
;; Mathbox basics:
(clerk/show! "src/cube_controls.clj")
;; functions:
(clerk/show! "src/functions.clj")
(clerk/show! "src/polar.clj")
;; symbolic physics:
(clerk/show! "src/einstein.clj")
;; vega, symbolic, double-pendulum
(clerk/show! "src/pendulum.clj")
;; mathbox physics:
(clerk/show! "src/oscillator.clj")
(clerk/show! "src/ellipsoid.clj")
(clerk/show! "src/double_ellipsoid.clj")
;; browser/client comms:
(clerk/show! "src/live_oscillator.clj")
NOTE: Clojure is far more pleasant if you can get a REPL running from inside of your favorite code editor. I'll update this repo with links to a good "Getting Started" resource; but please open an issue if you're having trouble and I'll get you sorted.
If you're running a REPL from inside your editor, see the Clerk
homepage for instructions
on how to trigger clerk-show!
with a key command, making dynamic interaction
much more fun.
The presentations themselves live in presentations/org/*.html
. see
presentations/README.md
for more detail on how to:
- build these
html
files from their associatedorg
files - generate slides by executing Clojure code
- Serve these presentations in presenter mode
Enjoy!