Martin Kavalar / Nov 23 2018

Clojure prepl + addlib

The following deps.edn is mounted into the Clojure runtime. This is using Clojure 1.10.0-beta8 , the prepl protocol and add-lib.

{:deps
 {org.clojure/clojure {:mvn/version "1.10.0-beta8"}
  org.clojure/tools.deps.alpha
  {:git/url "https://github.com/clojure/tools.deps.alpha.git"
   :sha "f6c080bd0049211021ea59e516d1785b08302515"}}}}
deps.edn
Extensible Data Notation

Let's start by using add-lib and returning the clojure-version.

(use 'clojure.tools.deps.alpha.repl)
(clojure-version)

We can use add-lib to add depedencies at runtime:

(add-lib 'org.clojure/core.async {:mvn/version "0.4.490"})

Once core.async is downloaded, we can require it.

(require '[clojure.core.async :as async])

And use it.

(async/timeout 100)

Happy hacking! 🎉