Fork me on GitHub
#data-science
<
2018-02-07
>
jeroenvandijk09:02:45

@chrjs I came accross a post of you about observablehq. You might find it interesting that i've put some cljs into it https://beta.observablehq.com/@jeroenvandijk/untitled/3

chrjs09:02:17

@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) 🙂

jeroenvandijk09:02:55

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

jeroenvandijk09:02:13

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

chrjs09:02:29

That’s a cool idea.

chrjs10:02:07

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

chrjs10:02:59

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

chrjs10:02:41

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

jeroenvandijk10:02:40

Exactly my thoughts 🙂

jeroenvandijk10:02:22

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

jeroenvandijk10:02:44

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

chrjs10:02:39

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

jeroenvandijk10:02:04

I was challenged by a collegeau 🙂

chrjs10:02:20

Dangerous 😉

keesterbrugge10:02:04

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

chrjs10:02:30

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

chrjs10:02:16

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).

chrjs11:02:27

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

jeroenvandijk11:02:00

@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}
`

chrjs11:02:01

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.

jeroenvandijk12:02:17

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 🙂

keesterbrugge14:02:33

> 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 http://www.mbmlbook.com/

chrjs14:02:50

I’m familiar 😉

chrjs14:02:38

(And I agree)