This commit is contained in:
Michiel Borkent 2020-01-12 20:46:00 +01:00
parent f066e32494
commit 880ac26793

View file

@ -249,9 +249,11 @@ Contains the function `add-classpath` which can be used to add to the classpath
dynamically: dynamically:
``` clojure ``` clojure
(require '[babashka.classpath :refer [add-classpath]]
'[clojure.java.shell :refer [sh]])
(def medley-dep '{:deps {medley {:git/url "https://github.com/borkdude/medley" (def medley-dep '{:deps {medley {:git/url "https://github.com/borkdude/medley"
:sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}}) :sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})
(def cp (:out (sh "bb" "clojure" "-Spath" "-Sdeps" (str medley-dep)))) (def cp (:out (sh "clojure" "-Spath" "-Sdeps" (str medley-dep))))
(add-classpath cp) (add-classpath cp)
(require '[medley.core :as m]) (require '[medley.core :as m])
(m/index-by :id [{:id 1} {:id 2}]) ;;=> {1 {:id 1}, 2 {:id 2}} (m/index-by :id [{:id 1} {:id 2}]) ;;=> {1 {:id 1}, 2 {:id 2}}