Fork me on GitHub

@chrjs I came accross a post of you about observablehq. You might find it interesting that i've put some cljs into it


@jeroenvandijk I do indeed! That’s a great use of mori. You’re giving me ideas for all sorts of things where an external compiler is needed (webPPL, for example) 🙂


I had to adapt mori slightly (update deps and export eval-str). I will push it to github for reference


I was also thinking of using clojure.spec to validate the data of vega configuration for instance. But maybe that's just trying to sell cljs to the rest of the world


That’s a cool idea.


I’d guess they’ve thought a bit about other languages (what with Jeremy Ashkenas being onboard).


Really, cljs already has all the tools (re-frame and klipse, I’m thinking) to make this kind of reactive notebook.


Only thing it’s missing is someone with oodles of time to do it 😬


Exactly my thoughts 🙂


The main thing I ran into doing this was getting clojurescript as a commonjs package/universal module definition. At some point i realized datascript and mori had done this before. And mori had basically all i needed


So i think to get something a la a cljs notebook of the ground with cljs we need something like for clojurescript libs. Once we have some boilerplate to load cljs libs (via eval i guess) it could work i think


Sounds like you’ve gone a lot deeper down the rabbit hole than I have.


I was challenged by a collegeau 🙂


Dangerous 😉


@chrjs Hi, since you mentioned using webPPL in observablehq you might find this answer interesting as well!topic/webppl-dev/7aCTwmvNUSo. Regards, Kees aka colleague


Yeah, afaik the only way to use it would be to write the model as a string, and call on it, as described there.


It’s a bit unsatisfying to have to stringify the model, but such is life (since javascript doesn’t have macros to do the cps transformation, webppl has to have a proper compilation step, cough unlike #anglican cough).


Also, who are you that know of webPPL!? Probabilistic programming is a bit of a niche (for now…).


@chrjs I don't know much about webPPL, actually it's the first time i hear about it, but from the examples page. Wouldn't something like this work for observablehq

In one cell

webPPL = function(args) {
    return require("your-webppl-stuff").then(function(webppl) {
      var model = eval("var identity = function(x) {return x}; identity('" + args[0] + "')")
      return webppl.Infer(model)

Then use it in other cells

webPPL `{method: 'enumerate', maxExecutions: 10, model: model}


I expect something like that will work, yeah. Just a little unsatisfying to have to put things through eval, instead of a true webPPL repl-like experience. But that’s not a criticism of observable, which I really like.


Yeah I understand, it is the same for clojurescript (see my question at the help forum). I guess we have to wait or to build it ourselves 🙂


> Also, who are you that know of webPPL!? Probabilistic programming is a bit of a niche (for now…). I'm from the future, it's the only way we do machine learning here. To get a glimpse see


I’m familiar 😉


(And I agree)