This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-15
Channels
- # announcements (3)
- # aws (2)
- # babashka (57)
- # beginners (24)
- # clj-kondo (5)
- # cljs-dev (11)
- # cljtogether (3)
- # clojure (83)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (32)
- # clojure-filipino (1)
- # clojure-hk (5)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-sg (1)
- # clojure-spain (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # clojurescript (7)
- # conjure (36)
- # data-science (19)
- # datomic (27)
- # emacs (44)
- # events (4)
- # fulcro (16)
- # honeysql (6)
- # inf-clojure (1)
- # interop (5)
- # malli (5)
- # nbb (1)
- # off-topic (19)
- # pathom (4)
- # practicalli (1)
- # remote-jobs (4)
- # ring (1)
- # shadow-cljs (72)
- # spacemacs (2)
Is it possible to de-structure namespaced keywords like {:profile/id 123 :profile/name "abc"}
Checkout also the destructuring guide for some additional information: https://clojure.org/guides/destructuring The Namespaced keywords section in particular
I'm going to write my first unit tests for a project, and I was looking for some inspiration. The core clojure.test
library seems fine, but perhaps I'd be missing out (I also like pytest way better than Python's core unittest library 😉). Any tips/experiences?
I've also heard positive stories about https://github.com/marick/Midje.
What sort of things are you missing in clojure.test
? Often clojure is much more extensible than you think if you feel something is missing 😉
If you are a beginner give clojure.test a try. It is good enough to begin with and only when (or if 😉) you hit some problems — look at another helpers
Midje has quite the mixed feelings here in the community and I'd also recommend start off with clojure.test and see whats missing
I'm unfamiliar with both (all) options, so I'm not missing something, but was curious what place was best to start.
Sounds like giving clojure.test
a try is a good way then.
Thanks 🙂
You may also use https://github.com/clojure-expectations/clojure-test as a clojure.test
extension in case you miss something.

Can't load library: /usr/lib/jvm/java-17-openjdk/lib/libawt_xawt.so
do you know why Can't load library: /usr/lib/jvm/java-17-openjdk/lib/libawt_xawt.so
ERROR: Unhandled REPL handler exception processing message {:op stacktrace, :nrepl.middleware.print/stream? 1, :nrepl.middleware.print/print cider.nrepl.pprint/pprint, :nrepl.middleware.print/quota 1048576, :nrepl.middleware.print/buffer-size 4096, :nrepl.middleware.print/options {:right-margin 70}, :session 8e0cd955-f748-4dc5-a446-fefdff3d06da, :id 445}
java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class java.awt.image.ColorModel
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at clojure.core$deref_future.invokeStatic(core.clj:2317)
at clojure.core$future_call$reify__8544.deref(core.clj:7041)
at clojure.core$deref.invokeStatic(core.clj:2337)
at clojure.core$pmap$step__8557$fn__8561.invoke(core.clj:7092)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:51)
at clojure.lang.RT.seq(RT.java:535)
at clojure.core$seq__5467.invokeStatic(core.clj:139)
at clojure.core$map$fn__5939.invoke(core.clj:2774)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class java.awt.image.ColorModel
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:467)
at clojure.lang.RT.classForName(RT.java:2209)
at clojure.lang.RT.classForName(RT.java:2218)
at clojure.lang.Compiler.maybeResolveIn(Compiler.java:7455)
at clojure.core$ns_resolve.invokeStatic(core.clj:4371)ERROR: Unhandled REPL handler exception processing message {:op eldoc, :ns user, :sym java.awt.image.ColorModel, :session 8e0cd955-f748-4dc5-a446-fefdff3d06da, :id 451}
java.lang.NoClassDefFoundError: Could not initialize class java.awt.image.ColorModel
nvm when I run without nrpel I get the same error. First clj start like usual, then I eval (require '[nextjournal.clerk :as clerk])
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2393).
Can't load library: /usr/lib/jvm/java-17-openjdk/lib/libawt_xawt.so
also this file does not exist at that location. Maybe I just need to install libaws_xawtah I'm almost certain it is because I have jre17-openjdk-headless
but I should use not headless to use clerk
What is the basic way to to run functions sequentially, but have the values available for subsequent functions? Like a do->
thread..?
I am trying to tie together api I/O functions, where there is some latency for results.
(I guess this falls into async territory?)
kind of like this:
(let [new-item-name "name"]
(create-item! new-item-name)
(let [new-item (get-item item-name)] ; with system-supplied id
(update-item! (:id new-item))))
could you rephrase your question? Not sure what you are asking, did you mean
(let [new-item-name "name"
new-item (create-item! new-item-name)]
(update-item! (:id new-item)))
Yes. That is simpler. But do the let
bindings resolve before the body runs?
create-item!
and update-item!
have network latency.
I guess in this case the update-item!
latency doesn’t impact the function.
I’m sorry, no, create-item!
and get-item
are separate. Because when an item is created, is is supplied with a unique :id
from the system.
So I need to “create”, and then “get” a particular entity, before I can “update” it (via it’s :id
)
(let [new-item-name "name"
;; assuming create-item! runs blocking and has the side effect of creating an item
_ (create-item! new-item-name)
new-item (get-item item-name)]
(update-item! (:id new-item)))
Like this everything runs sequentially.
It doesn't matter if any of those calls are doing long running io.
(same as your code but I put everything into a single let)Ok, Thanks for the clarification