Fork me on GitHub

@deactivateduser10790 Hum, not that I know, you can make one yourself. That said, you could also consider using metadata to mark a namespace as pure or not, same on your functions.

👍 3

Yeah that doesn’t let me differentiate at-a-glance in the filesystem (my main intent here is to communicate to humans, not to the computer).


Hum... I guess it depends where the human is looking


But (defn ^:pure foo [] ...) is pretty visible to a human


Same for: (ns ^:pure my-ns)


Yep those could work, though neither qualify as “at a glance in the filesystem” mechanisms.


Ya, I have no idea what you want this for, so you know best. Just saying it's an option as well.

👍 3

Hmm is there no if-let that takes multiple bindings?

Alex Miller (Clojure team)02:11:09

you can destructure though and let multiple values out of that (while if-ing on the collection)

Alex Miller (Clojure team)02:11:34

(if-let [{:keys [foo bar]} some-maybe-nil-map] ... )

Alex Miller (Clojure team)02:11:04

the if is based on whether some-maybe-nil-map is nil


My code would be something like when-let [foo (get-foo) bar (get-bar foo)] …


You may just want some->


@st3fan I've been using which includes when-let plus other -let constructs for multiple bindings


👋 hi all. Just wanted to introduce myself. I'm the co-founder of a startup in Canberra Australia that's building enterprise software on a clojure/script stack. key parts of our stack include datomic, keechma-next, sente and shadow-cljs. We're just starting out but over time I'd like to give back to the clojure community in various ways.

❤️ 6
👋 15

@st3fan exports a version of if-let and when-let that checks multiple bindings; I don't use them myself, but I do use the better/cond macro that is useful when writing code that starts leaning right towards multiple indent levels.


Thank you I’ll take a look at that one

Daniel Östling11:11:05

Is there an idiomatic way to merge vector of maps so that some values for some keys are aggregated, but others are not? Something like

[{:a "1", :b :some-keyword, :c "x"} {:a "1", :b :some-keyword, :c "y"}]

would be transformed into

{:a "1", :b :some-keyword, :c ["x", "y"]}
I’ve been playing around a bit with merge-with, but I can’t get it quite right.

Ben Sless11:11:53

I wrote this for a colleague some weeks ago, you might find it useful


it's not that pretty but it works:


(def data [{:a "1", :b :some-keyword, :c "x"} {:a "1", :b :some-keyword, :c "y"} {:c "z"}])

(apply merge-with (fn [m v]
                    (if (= m v)
                      (if (vector? m)
                        (conj m v)
                        [m v]))) data)


check the source code, it should be relatively simple to follow the code:

Daniel Östling11:11:36

Thanks, I appreciate it 🙂


cheers 🙂

Daniel Östling11:11:46

And thanks @UK0810AQ2, that also looks useful 🙂


sorry, there is a bug:


(merge-with (fn [m v]
              (if (vector? m)
                (conj m v)
                [m v])) {:a 1 :b 5} {:a 1 :b 3})


this will produce => {:a [1 1], :b [5 3]


which I think it's what you want

Ben Sless11:11:56

my foldmaps might even be overkill for your task, because you have only one "index". You can ofc just rip the indexing part out of it

Ben Sless11:11:27

you can just (reduce (map-combiner {,,}) ms)

Daniel Östling12:11:08

Yeah, I’ll take a closer look. I like to understand code I use 🙂

Daniel Östling12:11:49

Thanks guys 🙂

🙂 3
Ben Sless12:11:40

godspeed 🙂


anyone used googles artifact repository with clojure jars managed to upload but cant convince deps to checkout the jar

Jim Newton13:11:31

help calling java method. I'm looking at the source code for isa? and I see the line:

(and (class? parent) (class? child)
            (. ^Class parent isAssignableFrom child))
How can I call the isAssignableFrom method from the repl? Do I need to qualify it with some java.this.and.that/isAssignableFrom, or do I need to require something into my repl? Here's the error I'm getting.
(. Number isAssignableFrom Long)
Syntax error (IllegalArgumentException) compiling . at (clojure-rte:localhost:51477(clj)*:318394:23).
No matching method isAssignableFrom found taking 1 args for class java.lang.Number


(.isAssignableFrom Number Long)

✔️ 3

Sorry, realized that I wasn't actually answering your question, but the above should work nonetheless.

😀 3

Oh no I need a YAML library


What is an idiomatic way to translate something like this to Clojure:

if (foo && bar) {

if (something == false) {

if (something_else) {



I’m trying to avoid inverting those conditions and creating a huge indented if pyramid


factor it out in a function and just use or ?


inverting expressions makes the decision logic hard to read

Alex Miller (Clojure team)13:11:09

I mean, this is already weird because it's a void method and those don't exist in Clojure

Alex Miller (Clojure team)13:11:15


  (and foo bar) nil
  (false? something) nil
  (something_else) nil
  :else (dosomething))

Alex Miller (Clojure team)13:11:21

is effectively the same

Alex Miller (Clojure team)13:11:14

maybe at that point I'd do:

(when-not (or (and foo bar)
              (false? something)


from what I can figure out i need to use a wagon in deps.edn but not finding anything online

Alex Miller (Clojure team)14:11:17

clj does not have support for custom wagons/transporters right now

Alex Miller (Clojure team)14:11:37

filing a request at would be a great place to make a votable thing that we can track

Alex Miller (Clojure team)14:11:29

the underlying tools.deps lib does support custom procurers but does not specifically support custom transporters or wagons, but that is possible to add


okay thanks for the info, i was about to ask on reddit 🙂 I will post on ask.clojure as suggested


although ask only seems to let you register with github 😞


thanks anyway, i will go back to using lein for now


perhaps i will post on reddit as well just so there is some history 🙂

Alex Miller (Clojure team)16:11:06

well posting there will cause nothing to change if that is your goal

Alex Miller (Clojure team)16:11:31 is where we collect and determine the priority of requests


how come it only has github sign up seems flawed if its the main way to track stuff


will have another look perhaps i missed sign up button

Alex Miller (Clojure team)16:11:08

it is github only right now

Alex Miller (Clojure team)16:11:44

most devs have a github acct so that has not generally been an impediment so far. if you don't have one, I can file a request for you there


that would be very helpful, I am also a bit suspect of the legitimacy of that site as it has various issues or perhaps its just very new


not a site I have come across in the clojure eco system previously anyway


posting on reddit for posterity anyway as i will probably need the work around again


no ask.clojure

Alex Miller (Clojure team)16:11:00 is the official clojure Q&A site run by the core team, of which I am a member. I run it.

Alex Miller (Clojure team)16:11:18

I'm also the primary dev on tools.deps and clj


oh I did not knwo that


is it supposed to look like that on a desktop ?


feels like a mobile version and the x is mis aligned

Alex Miller (Clojure team)16:11:13

that does look like the mobile layout - but it's a responsive layout so looks different as you widen it


I get column if i widen it and a categories box, not try to offend just thought i would point out if there is an issue


good work on tools.deps anyway I actually really like it as a build tool for managing my projects


 {"artifactregistry" {:url ""}}}
I have added the above to deps.edn but seems it does not understand artifact-registry from what i can work out it needs to launch something to add that protocol format, not finding any details on how to go about that how ever 😞

Gleb Posobin14:11:57

I have read a bunch of stuff about spec, but still don't understand when I am supposed to use it. Should I spec every function definition? What about the performance costs of that? Also, spec suggests that the keywords I use in hash-maps should be namespaced, is that a standard practice? I haven't seen that recommendation anywhere else I think, besides fulcro docs maybe.


I believe it is fairly common for those who use spec to use it in production only to check inputs at the boundaries of major subsystems, e.g. for requests from outside of one piece of software, or perhaps sometimes between major subsystems. The run-time cost can be mitigated by being selective. For test time, it can be worth the extra checking time to enable checking at many more places. For testing individual functions or groups of your functions, generative testing, e.g. with test.check can help provide good test coverage at test time.


Is this one of the articles you read on spec? It is written by a long time Clojure developer who has used spec in their production Clojure code for several years now.

Gleb Posobin14:11:13

No, I don't think I have read that one, thank you!

Gleb Posobin14:11:27

So I should define some of the specs inside test namespaces then, if I want them to run during test time?


I believe some people create completely separate namespaces for spec definition, so that they can be loaded only when desired. By doing that, they can be loaded at test time, true, but they can also be loaded at production time without loading in all of the test code.

Gleb Posobin14:11:05

I see, makes sense, thank you. I'll read the post and ask more questions if I have any.


Probably the only reason the author didn't answer your question before I did is because it is very early Pacific time right now 🙂

😄 3

seems mixing lein and deps.edn using this plugin and then using lein-tools-deps to read the deps.eddn file seems the dependencies are merged would be nicer to do this all in deps file if its possible ?

Louis Kottmann15:11:08

do I get it right that clojure.core.async/go and future have the exact same purpose, except for their respective thread/pool subtelties?

Louis Kottmann15:11:09

and then, considering the error handling overhead that comes with future, I should use go if I don't care about threading boundaries?

Alex Miller (Clojure team)15:11:52

I'd say they have entirely different purposes actually but if you're not doing any async ops, I'd use future

Louis Kottmann16:11:25

what do you mean, "not doing any aync ops"?

Alex Miller (Clojure team)16:11:02

parking ops like >! <! etc

Louis Kottmann16:11:11

my actual current project uses futures, but I never dereference them (their purpose is network side-effects)

Alex Miller (Clojure team)16:11:28

you should not do blocking io operations in go blocks

Louis Kottmann16:11:38

and I'm really torn between keeping them and using core.async

Alex Miller (Clojure team)16:11:39

as it is a fixed size pool and you can lock it up that way

Alex Miller (Clojure team)16:11:09

it does not seem like you have a use case that matches core.async afaict

Louis Kottmann16:11:37

and using go blocks with futures inside for the IO parts, would be overkill?

Louis Kottmann16:11:26

I guess I really don't like the errors popping in places totally different from the actual crash place (I use try/catches with every futures), and naively believe that go blocks would somehow solve the problem

Alex Miller (Clojure team)16:11:06

yeah, it would not help you with that

Alex Miller (Clojure team)16:11:28

it does not seem like core.async solves any problem you have and likely introduces new ones :)

Louis Kottmann16:11:08

ok let's avoid that pitfall then, thank you!

Roger Amorin Vieira18:11:01

Hi, I dont know if is a bug, but last week, this work like that:

> (format "%.3f" 2.0)
Now the same thing is giving to me:
> (format "%.3f" 2.0)


@contato509 that looks like something that would be controlled by the LOCALE environment variable


oops - not LOCALE itself, but the locale system, that uses LANG, LANGUAGE, LC_CTYPE, LC_NUMERIC etc. (on linux at least)

Roger Amorin Vieira18:11:52

Was that thanks

🍻 3