This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-02-19
Channels
- # babashka (7)
- # beginners (29)
- # biff (10)
- # cherry (6)
- # cider (23)
- # clj-kondo (9)
- # clojure (54)
- # clojure-europe (27)
- # clojure-nl (2)
- # clojure-norway (10)
- # clojure-uk (5)
- # datomic (14)
- # deps-new (1)
- # events (7)
- # figwheel-main (3)
- # hyperfiddle (9)
- # lsp (4)
- # malli (12)
- # off-topic (8)
- # other-languages (2)
- # releases (3)
- # shadow-cljs (104)
- # specter (1)
- # tools-deps (12)
morning
Bore da
Good morning!
(= ".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.
Yes, I'm afraid. (Still trying to understand the code 😛 )
I'd go with (.endsWith f ".jpg")
🤷
Or, if you need to support multiple endings, just (re-matches #"\.jpe?g$" f)
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.
(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. 😉
Morning