probcomp / metaprob

An embedded language for probabilistic programming and meta-programming.
GNU General Public License v3.0
168 stars 17 forks source link

Support ClojureScript compilation of metaprob.state and metaprob.state-test #93

Closed zane closed 5 years ago

zane commented 5 years ago

What does this do?

Adds support for compiling the metaprob.state and metaprob.state-test namespaces to JavaScript via the ClojureScript compiler:

What are the pros and cons of this?

Pros

Allows us to compile these namespaces to ClojureScript.

Cons

Increases the complexity of the system.

How do I test this?

  1. Run the tests via make test (or, to just run the ClojureScript tests, make cljstest).
  2. Start a ClojureScript REPL with clj -Acljs -m cljs.main -re nashorn --repl (or -re node if your system has node installed, and try requiring and working interactively with metaprob.state at the REPL:
    cljs.user=> (require 'metaprob.state)
    cljs.user=> (metaprob.state/empty-state)
    {}
jar600 commented 5 years ago

I looked over the diff. Looks fine to me. This message constitutes my review.

alex-lew commented 5 years ago

Modifies metaprob.state and metaprob.state-test to be valid Clojure / ClojureScript and renames them from .clj to .cljc. .cljc is the extension Clojure tooling expects for cross-compileable Clojure code.

Were there any changes to metaprob.state to make it valid Clojure/ClojureScript? It looks like the renaming was all that happened? (If so, that's awesome!) The diff looks good to me :+1:

zane commented 5 years ago

@alex-lew Yep! No changes for this one! That, along with the fact that it has no dependencies of its own, is why I started with it. ☺️

jar398 commented 5 years ago

Speaks to #14