Fork me on GitHub
#clojure-europe
<
2024-02-19
>
grav06:02:27

Morning!

schmalz07:02:02

Morning all.

dharrigan08:02:42

Good Morning!

maleghast09:02:43

madainn mhath :flag-scotland:

👋 1
ordnungswidrig10:02:54

(= ".jpg" (some->> f (re-find #"(\.[a-zA-Z]+)$") second str/lower-case)) Code perl of the day. What a strange way to start into the week.

borkdude10:02:25

Is this to find a file extension?

ordnungswidrig10:02:48

Yes, I'm afraid. (Still trying to understand the code 😛 )

pez10:02:03

The grouping seems unnecessary?

ordnungswidrig10:02:54

I'd go with (.endsWith f ".jpg") 🤷

ordnungswidrig10:02:36

Or, if you need to support multiple endings, just (re-matches #"\.jpe?g$" f)

pez10:02:50

Was about to say. 😃

pez10:02:19

Though it still may make more sense to use babashka.fs or similar to extract the extension, lowercase it and test it against some list.

ordnungswidrig10:02:36

(re-matches #"(?i)\.jpe?g$" f) should be fast and precise. Anyways, I was just surprised be the initial code snippet I had found and it took me a while to understand what it really wanted to achieve. 😉

pez10:02:15

I like the term code perl, btw. TIL.

Ed10:02:57

Presumably "code perl" is code that is write-only and named at PERL code?

Ed10:02:57

Morning