Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active May 24, 2018 12:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/a69c72e65330e92625bfa81d5501dad4 to your computer and use it in GitHub Desktop.
Save mfikes/a69c72e65330e92625bfa81d5501dad4 to your computer and use it in GitHub Desktop.
add-lib ClojureScript
clj -Sdeps '{:deps {github-mfikes/a69c72e65330e92625bfa81d5501dad4 {:git/url "https://gist.github.com/mfikes/a69c72e65330e92625bfa81d5501dad4" :sha "700c681f61eae580be3f52181e15c221fa23b77c"}}}' -m cljs.main -re node -r

This sets you up to use Alex Miller's new add-lib capability, hacked into a revision of ClojureScript.

Once the REPL is running, call add-lib to dynamically require a Git Dep library (or a :mvn/version, or a :local/root dep):

cljs.user=> (require '[cljs.repl :refer [add-lib]])
nil
cljs.user=> (add-lib 'andare {:git/url "https://github.com/mfikes/andare" :sha "8a06ac29054c261d97539aa85a2aed0a41012313"})
Cloning: https://github.com/mfikes/andare
Checking out: https://github.com/mfikes/andare at 8a06ac29054c261d97539aa85a2aed0a41012313
true
cljs.user=> (require '[clojure.core.async :refer [chan <! >! go]])
nil
cljs.user=> (def c (chan))
#'cljs.user/c
cljs.user=> (go (prn (<! c)))
#object[cljs.core.async.impl.channels.ManyToManyChannel]
cljs.user=> (go (>! c :hello))
#object[cljs.core.async.impl.channels.ManyToManyChannel]
cljs.user=> :hello

cljs.user=>
{:deps {org.clojure/clojurescript {:git/url "https://github.com/mfikes/clojurescript"
:sha "d68c9397599366777d9b322ec586fdd398302f25"}
org.clojure/tools.deps.alpha {:git/url "https://github.com/clojure/tools.deps.alpha.git"
:sha "d492e97259c013ba401c5238842cd3445839d020"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment