Fork me on GitHub

For those of you using Aero ( for configuration, do you use #profile within a single configuration file, or do you maintain per-environment configs and then load the appropriate file based on the specified environment profile?


@UGTAV6LR2 I use #profile within a single configuration file, because I think repeating configuration keys in different files is error prone.


if I'm passing an optional function as an argument and want that optional function to just return false otherwise, how can I make it so I don't have to specify all the arguments that function takes in the default declaration? so I'd like to do something like this:

(defn foo [] 
 ([s] (foo s #(identity false)))
  ([s bar?] (if (bar? s) s nil)))
but i'm receiving multi arity exception. so instead i have to make the inline function declares its args:
(defn foo [] 
 ([s] (foo s (fn [_] false))
  ([s bar?] (if (bar? s) s nil)))


i wouldn't even mind listing out the optional args but then i get linter errors so instead in second example i use underscore


I think you want (constantly false)

👍 1
Alex Jackson17:12:49

hi folks, I'm having what I suspect is a Leiningen or environment issue but I'm having a hard time figuring out what is going on. My dependencies in my project.clj file are getting downloaded and appear to exist on my class path. however, when I try to include them through a require statement, either as part of (ns) or just a straight up (require)

(require '[clj-time :as t]) 
Execution error (FileNotFoundException) Could not locate clj_time__init.class, clj_time.clj or clj_time.cljc on classpath.
here is my project.clj file
(defproject test_project "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.0"]
                 [clj-time "0.15.2"]]
  :main ^:skip-aot test_project.core
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all}})
I am able to import the clj-time library if I create an empty folder with a deps.edn file that has that dependency defined and then run the repl from that folder. Any thoughts on how to troubleshoot?


Require is for namespaces


What goes in project.clj is a maven coordinate


The namespace names will be something different and you will have to look at the documentation for the libraries your using to find the namespaces it provides

👍 1
Alex Jackson17:12:41

ah ok! thank you. looks like I needed to use clj-time.core as the namespace


clj-time is deprecated and not recommended fyi


See its readme

Alex Jackson18:12:15

thanks. that was just what I was using as an example


@UQV85KLF5 FWIW, the clj-time README shows how to require the library but, as Ghadi says, it's is deprecated and we recommend Java Time instead (I'm one of the clj-time maintainers).

👍 1