Fork me on GitHub

Any recommendations for good reads how to build a (simple) application with Clojure? I understand the basics for data manipulation, but I struggle with control flow, user interface and working with immutability in practice.

Ben Sless07:04:43

desktop? web app? CLI?


Web app would be the target, but I am happy to start with some simple desktop apps if that is easier to start.

Ben Sless09:04:27

Web app would be easier, actually, take a look at

πŸ™ 3
Eric Ihli12:04:38

Are there any gotchas or concerns about putting side-effects in a transduction? I searched and found and my understanding is that what the original asker is doing should be fine since transduce/reduce is non-lazy. But the first line of the answer that says "Transducers are a new feature and best practices are still emerging" make me wonder if the best practice that has emerged may be that it's a bad idea for some reason.


Just inherited ` (some->> (get-in db [:hi :mom]) (into [])) Curious about (into []). Why not just a literal []? Thx!


(let [res '(:a :b :c)]
   (into [] res))
=> [:a :b :c]

(let [res '(:a :b :c)]
=> [(:a :b :c)]
With the literal [] you won't get the conj type behaviour, so you will end up with a nested collection?


I usually use vec for this, but (into []) might communicate the intent clearer.


I have a ring-jetty server. I use 3rd party libraries in my server which make network requests (think stripe sdk). I would like to monitor the network requests my server is making. What do people like to do for this? I use Charles Proxy to monitor front end requests, but i’m not sure if this tool is also used for monitor requests my server makes :thinking_face: (apologies if there is a better channel for this post as I know it’s not really Clojure specific)


Hello, could anyone help me with the following: how do I realize a lazy seq and spit it into a edn file?


Nvm my bad I was looking into the wrong file πŸ™ˆ πŸ˜‚ I'm sorry


if you change a lot of code multiple times and nothing changes... maybe it is a different file xD ... hard-won lessons of coding

❀️ 4

The nice thing of that advice is that it is independent of programming language πŸ™‚

πŸ˜† 2

I am trying to find a nice linter. I currently use eastwood and kibit, what do people generally use?


clj-kondo #clj-kondo


will check it out. I was expecting eastwood to throw errors for unused imports


It did not.


clj-kondo will flag unused imports

Daniel Basner20:04:38

is there a way to use the value being threaded in cond-> in the condition used to decide whether or not to call the associated fn? if you do

(cond-> db
  true (something-that-changes-db)
  (some-cond? db) (called-conditionally)) 
the value used in that condition seems to be the original db, not the newly updated db value


Well, db is never updated


db is a name bound to an immutable value

Daniel Basner21:04:15

yeah, it makes sense that the above does not work, having looked at it, but I was wondering how I could use the updated value in that next cond

Daniel Basner21:04:11

kind of like a combo between cond-> and as-> where you can thread the updated value through any position(s) you want


There is nothing built it for it, but various libraries add their own macros that do that sort thing like

Daniel Basner21:04:37

thanks! I will take a look


The thing to watch with condp-> is that all of the conditions must be predicate expressions: you start with cond-> db true ... so that true needs to be something that db can be threaded into and will yield true.


(condp-> db (or true) (something-that-changes) (some-cond?) (called-conditionally)) might be what you need: db is threaded as the first argument into the first condition and (if truthy) the first result expression, and the result of that will be threaded into (some-cond?) and if that's truthy, it'll be threaded into (called-conditionally) -- make sense?

Daniel Basner21:04:44

yeah, thanks! example is super helpful


$ clj -Sdeps '{:deps {worldsingles/ws-commons {:mvn/version "RELEASE"}}}'
Downloading: worldsingles/ws-commons/maven-metadata.xml from clojars
Clojure 1.10.3
worldsingles/clojure/extensions.cljc on classpath.
user=> (require '[ws.clojure.extensions :refer :all])
user=> (condp-> 42 (or true) (inc) (odd?) (inc))
user=> (condp-> 42 (or true) (inc) (even?) (inc))


with-open with a custom closing problem looks generic enough that I am expecting something pre-written.


Maybe in a 3rd party library (not one I know about, unfortunately), but I don't think such a thing is built in.


You could use something like proxy to create a one-off object with a close method that calls your custom close method.


and use built-in with-open on that object.


I haven't done this before, so may be getting confused over whether proxy, reify, or something similar is the best choice here.


that is a good idea.


will try that.