Skip to content

Instantly share code, notes, and snippets.

@mjdiloreto
Last active June 16, 2022 01:48
Show Gist options
  • Save mjdiloreto/9eca5584e394df07de1fd44fe1abc6ab to your computer and use it in GitHub Desktop.
Save mjdiloreto/9eca5584e394df07de1fd44fe1abc6ab to your computer and use it in GitHub Desktop.
Clojure dependencies with org-babel

Literate Dependencies

Dependencies

Below are my project’s dependencies. ☝ Notice the tangle property above.

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.10.1"}
        org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}

Math tests

Here we can test out the included dependencies.

  1. First, run org-babel-tangle so that the project’s dependencies are written to deps.edn
    1. You’ll have to do this each time you add a dependency above.
  2. Next, run org-babel-execute-src-block in the below source block.
    1. The resulting clojure session will use the created deps.edn by default.
(ns math-test
  (:require [clojure.math.combinatorics :as combo]))

(combo/cartesian-product [1 2] [3 4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment