clojure-europe

thomas 2026-06-19T05:38:47.061979Z

Good morning. Day 5 Düsseldorf to Bonn. Plan is to cross the Rhine and stay there. Go through Cologne passes the Dom and on to Bonn. I'll let you lovely people know how it goes.

🚴 3
thomas 2026-06-19T05:59:37.630059Z

And now Google maps gives a different route from last night's 😔

thomas 2026-06-19T05:59:48.952829Z

Wtf?

thomas 2026-06-19T11:05:07.584109Z

Bloody hot today. Out average speed lower.

thomas 2026-06-19T11:05:21.349269Z

Going to be a long day

thomas 2026-06-19T14:26:59.439849Z

Ok, we cheated. We took the train from Cologne to Bonn. Too hot.

thomas 2026-06-19T14:35:57.437699Z

And my phone got so hot during the day it shutdown all the apps.

gunnar 2026-06-19T05:54:46.174799Z

Safe travels! And good morning 🙂

simongray 2026-06-19T07:39:20.384129Z

good morning

reefersleep 2026-06-19T08:14:01.089019Z

Good morning!

jasonbell 2026-06-19T12:56:49.723049Z

Morning

reefersleep 2026-06-19T12:58:20.081329Z

I saw something like this in $workplace's code base today

(defn parse-x [{:keys [foo bar baz zod]}]
      {:foo foo
       :bar bar
       :baz baz
       :zod zod})

(defn parse-xs [xs]
      (->> xs
           (map parse-x)
           (sort-by :foo)))
I hope whoever wrote that took a nap afterwards

teodorlu 2026-06-19T13:31:24.523949Z

so ... parse-x is poor man's select-keys? just that it also fills in nil values?

reefersleep 2026-06-19T13:32:14.083849Z

Yes, except no caller ever has other keys than those keys. And it doesn't matter downstream whether keys have nil values or are exempt from the map.

teodorlu 2026-06-19T13:32:25.340459Z

😂

reefersleep 2026-06-19T13:32:34.071149Z

🫠

reefersleep 2026-06-19T13:33:17.561659Z

So it's more like a verbose identity for this particular use case. (I tested it with clojure.data/diff to ensure that my eyes weren't lying to me)

reefersleep 2026-06-19T13:33:38.516019Z

(clojure.data/diff x (parse-x x))

teodorlu 2026-06-19T13:34:05.408239Z

I've come to dislike excessive indirection. I don't think I've seen completely unnecessary indirection in the wild 😄

teodorlu 2026-06-19T13:36:20.898209Z

Maybe the author had excessive experience plucking from structs and putting back into different structs, and followed a pattern they'd seen in a different codebase? parse-x does make the keys known.

Ben Sless 2026-06-19T13:37:05.750249Z

That's a wat for me

➕ 1
reefersleep 2026-06-19T13:39:20.579339Z

Sure. I've also come to dislike excessive indirection; often, you can just inline clojure core functions and have completely readable code. I'm also a fan of making keys known, so I shun e.g. frivolous use of (merge x y). What's the result? Who knows. Instead, I do

(let [{:keys [the keys I need from]} x
      {:keys [and]} y]
        {:the the
         :and and})

reefersleep 2026-06-19T13:40:02.519869Z

Silly example of course

reefersleep 2026-06-19T13:40:57.749149Z

@teodorlu I think the developer is certainly a "try to follow existing patterns"-type of person

⬛ 1
reefersleep 2026-06-19T13:41:22.414849Z

Which is not bad, but remember to (apply brain)

😆 1
reefersleep 2026-06-19T13:42:14.977469Z

It is hot though, so maybe the brain isn't worth much 🫠

teodorlu 2026-06-19T13:46:03.079179Z

I merge and assoc all the way! Heterogenuous maps all the way, baby! But namespace qualified keys preferred ☺️

2026-06-19T13:54:31.548329Z

> I’ve come to dislike excessive indirection. “The princess is in another castle” code

teodorlu 2026-06-19T13:56:21.785079Z

I want my princesses at hand, dammit!

2026-06-19T13:57:03.179299Z

Now i gotta remember that foo called bar called baz and that just happens to be select-keys. Just use select-keys please, I dont have enough L1 cache in my head for your indirections

reefersleep 2026-06-19T13:58:18.588049Z

Exactly. So many home brewed names for what is really just a line or two of clojure core functions.

🎯 1
☝️ 1
2026-06-19T13:59:43.334089Z

there is some level of ‘apply taste’ tho. At some point someone is map filter reducing one data structure into another… maybe give that a name so that I don’t have to mentally attach one :’)

reefersleep 2026-06-19T14:00:29.995499Z

Of course 🙂 It's all a balance act.

2026-06-19T14:05:17.689929Z

I struggle with that sometimes. Like, some people, as you suggest, try to follow some pattern and I have a hard time writing “don’t make me navigate needless indirections” but “sometimes give a thing a name to make it more clear” as a rule.

reefersleep 2026-06-19T14:20:05.736619Z

haha yeah

reefersleep 2026-06-19T14:20:20.542009Z

just think the way that I do and we'll be fine

❤️ 2
fmjrey 2026-06-19T18:18:57.915479Z

Another possibility is to guard against mutable java.util.Map