This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-25
Channels
- # announcements (3)
- # asami (63)
- # babashka (5)
- # babashka-sci-dev (32)
- # beginners (56)
- # calva (2)
- # cider (28)
- # clj-commons (9)
- # clj-kondo (16)
- # cljdoc (41)
- # cljs-dev (19)
- # clojure (67)
- # clojure-europe (15)
- # clojure-nl (1)
- # clojure-poland (1)
- # clojure-uk (2)
- # clojurescript (27)
- # community-development (10)
- # data-science (2)
- # datascript (8)
- # datomic (21)
- # events (3)
- # fulcro (54)
- # graalvm (18)
- # introduce-yourself (2)
- # juxt (3)
- # lsp (6)
- # music (1)
- # nextjournal (8)
- # off-topic (44)
- # omni-trace (1)
- # reitit (13)
- # releases (3)
- # rewrite-clj (4)
- # shadow-cljs (10)
- # spacemacs (6)
- # sql (12)
- # tools-build (17)
- # tools-deps (3)
- # web-security (1)
is there some idiomatic way, other than read-string
, of grabbing an artifact version out of a deps.edn
file? I need this on the command line from a bash script and I can do the read-string
call via a call to clojure
with appropriate code snippet. Was perhaps hoping there would be something built in to say tools.deps to accomplish this?
right, yes, that would work but this is part of a build process checked into a git repo and I was hoping to not have to install additional binaries on the building server...so if possible I'm looking for a clojure solution, clojure deps are ok as they can be auto-downloaded, but would prefer to stay away from system binaries
I have a test which is comparing 2 maps when I run the test I get this result which I don't understand as that looks the same, I have done an external diff and both maps seem to be identical but I still see the test fail with the below diff. anyone got any pointers ?
diff: - nil
+ nil
The maps are nested so maps in maps and vectors as key values they also have time and uuid literals like these #time/instant "2019-06-05T08:48:45Z"
If i intentionally change the maps the diff shows the correct keys as different, I have done similar tests before and not encountered this behaviour
Another question about map comparisons! How would you approximately compare two maps based on some epsilon value, e.g.:
(let [m1 {:a 46.042
:name "Jim"}
m2 {:a 45.041
:name "Jim"}
eps 0.005]
(approx= m1 m2 eps))
;;=> true
the maps could be arbitrarily nested
I suppose I could walk over the map and use something like https://github.com/clojure/algo.generic/blob/48f3894155abbc14835213281d01355af683b47a/src/main/clojure/clojure/algo/generic/math_functions.clj#L208-L212 for numbers and clojure.core/=
for other non-collection types but I'm not sure it's the right approach, it feels kinda wrong.
How do people usually solve this?you could use https://clojuredocs.org/clojure.data/diff to pull a list of differences and then compare only those
I did actually try that I get back nil nil and the map as the 3rd parameter, which I believe means no differences if the first and second value are both nil
I just went down the route of dissocing keys to find the key but its a key with a vector of maps which only contain strings or integers so nothing esoteric
sorry, I was actually replying to @pavlosβs question :)
any chance you have a nil value and programatically constructed symbol with the value nil
?
(symbol "nil")
^^ bad, but possible :)
Fail in t
expected: {:id 6,
:merchant_id 2,
:billing_period 2,
:name "Deactivated Feed",
:feed_type_id 2}
actual: {:id 6,
:merchant_id 2,
:billing_period 2,
:name "Deactivated Feed",
:feed_type_id 2}
diff: - nil
+ nil
I have drilled into the hashmap to get at this sub map which is failingFail in t
expected: {}
actual: {}
diff: - nil
+ nil
Even more confused now no key values left and it still fails πso one is a clojure.lang.PersistentArrayMap the other is a postgres instance which happens to display as a hashmap when displaying
@oliver.marks I think I've sometimes seen that when the values you're comparing are a map and a record
(defrecord Foo [foo])
(deftest foo-test
(is (= (map->Foo {:foo "foo"}) {:foo "foo"})))
looks like you got a handle on it though π
yeah be nice if the diff could report that kind of difference the amount of lost time trying to nail down the issue :p
Hi. I try to instantiate class javax.jms.ServerSessionPool that has no ctor and get
Execution error (ClassCastException) at aq-test.consumer/receive-msg (consumer.clj:11).
class java.lang.Class cannot be cast to class javax.jms.ServerSessionPool (java.lang.Class is in module java.base of loader 'bootstrap'; javax.jms.ServerSessionPool is in unnamed module of loader 'app')
Parts of my code that are related:
(ns aq-test.consumer
(:import [javax.jms ServerSessionPool]))
...
(let consumer-instance [(.createConnectionConsumer connection queue "JMSPriority BETWEEN 3 AND 7", ServerSessionPool, 1000)] ;; <-- Failing here
Any hints how to proceed?yup -- and if I change it to (ServerSessionPool.) I get
Syntax error (IllegalArgumentException) compiling new at (/tmp/form-init8842840836338661175.clj:1:215).
No matching ctor found for interface javax.jms.ServerSessionPool
This ServerSessionPool thing seems not having any constructors
yup -- and if I change it to (ServerSessionPool.) I get
Syntax error (IllegalArgumentException) compiling new at (/tmp/form-init8842840836338661175.clj:1:215).
No matching ctor found for interface javax.jms.ServerSessionPool
it might not even have a public constructor; might get one from some static factory method somewhere (I don't know)
it's an interface, so it might come from the JMS concrete backend library that you are using
Oh, so additionally the implementation may be needed? I didn't thought of that. Thanks!
Where is the config file for clj
so I can put this mess in it? It doesn't make any sense to put it in every project's deps.edn, but I can't find docs about any other config.
{:deps {cider/cider-nrepl {:mvn/version "0.27.3"} }}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
{:aliases
{:cider/nrepl
{:extra-deps {nrepl/nrepl {:mvn/version "0.9.0-beta3"}
cider/cider-nrepl {:mvn/version "0.27.2"}}
:main-opts ["-m" "nrepl.cmdline"
"--middleware" "[cider.nrepl/cider-middleware]"]}}}
Who can I bug to get that on this page? https://clojure.org/guides/deps_and_cli
Under the heading "Operation" you can find this line: User - cross-project configuration (typically tools), usually found atΒ `~/.clojure/deps.edn`
Ah. Should have been this link: https://clojure.org/reference/deps_and_cli#_operation Thanks!
Issues about the docs welcome at https://github.com/clojure/clojure-site/issues
@U02UHTG2YH5 you are right. I totally sent the wrong link. I glanced quickly before doing a little meeting and it looked like the right thing. Sorry about that
You may find this user level configuration interesting, it has lots of examples of aliases for tools, libraries and middleware like Cider https://github.com/practicalli/clojure-deps-edn