Clojure Dependencies

1.
Create the :deps Map

Loading a dependency in Clojure ​should feel familiar if you've used deps.edn. First, create a Code Listing cell and enter your dependencies just as you would in any deps.edn file.

{:deps {clj-time {:mvn/version "0.15.1"}}}
deps.edn
Extensible Data Notation

Note: I have chosen Assign Name... from the cell's contextual menu and called it deps.edn. This is optional, but makes it easier to find later on.

If you have not created a Clojure runtime, create a blank cell by selecting Code Cell: Clojure under + Add new content. Leave it blank for now

2.
Load the Dependencies and Restart

Mount the file in the Clojure runtime by selecting the gear icon and selecting + Add mount. You're looking for either code-listing or deps.edn, depending on whether or not you assigned a name to the cell.

Mount deps.edn

Once added, Nextjournal will as you to Apply & Restart the runtime.

Apply & Restart Clojure

3.
Require the Dependencies

Type your require statement into the blank Clojure cell just as you would in any Clojure REPL.

(require '[clj-time.core :as t])

Create a new cell and type a command using the library.

(t/hour (t/date-time 1986 10 14 22))
© 2018 Nextjournal GmbH