Super cool that you got something working inside of a notebook!
Though it would be super cool to add more languages in, it’ll be a pretty gradual process. Unlike most other notebooks, Observable is very semantic - a lot of the magic is how a mixture of static analysis and a smart runtime can simplify programming. We wouldn’t want to, say, add ClojureScript support but require you to manually re-evaluate cljs cells - we’d want cross-language evaluation to be at least reasonably reactive, in the way that evaluation is currently reactive.
Of course no shade on ClojureScript (I’ve built a few things with Clojure and mightily enjoyed it), but the focus for now is on making an exceptional environment, and then on potentially cross-language capabilities.
I suppose you can always try the tagged template approach, but then the other language is more like a pre-processor (edit: just noticed that this is exactly how the ClojureScript works in linked notebook at the start (waarom is Kees eigenlijk een topper, @jeroenvandijk?))
Take a look in the ganja.js topic for more ideas:
Also, you just inspired me to try embedding the Walt compiler in the Observable notebook, seems to work pretty well!
very nice notebook! to make it work on a retina screen, you might want to use context = DOM.context2d(width, height, 1) or adapt all the canvas.onmouse* (otherwise it paints only the top-left quarter of the screen).
Yes they have the correct size, but you can see they’re using “non retina pixels”.
But as you’re making the images with a matrix and putImageData(), I don’t think you want to have to think about devicePixelRatio.
That is cool! I’m also working on adding support for another language to Observable. It would be very nice if there were an extensible way to e.g. syntax-highlight the code inside a cljs or html or svg block.
It would also be incredibly cool if it were possible to make ”cljs cells” the default cell type, which would mean pre-populating the text of any new cell with the template literal and placing the cursor in between the backticks.