clojure-europe

2026-03-25T08:23:54.460789Z

morning

2026-03-25T08:24:17.937019Z

congrats to Denmark for having an election. I hope you have many more in the future.

πŸ˜† 6
🫑 1
teodorlu 2026-03-25T08:43:10.245709Z

Good morning!

thomas 2026-03-25T08:45:34.135139Z

mogge

simongray 2026-03-25T08:54:42.305059Z

good morning

ray 2026-03-25T10:59:55.331219Z

Good contemplative morning

reefersleep 2026-03-25T11:11:41.017129Z

Good morning 😊

ray 2026-03-25T14:00:11.262189Z

Anyone else getting πŸ¦„πŸ¦„πŸ¦„πŸ¦„πŸ¦„ from Microslopt GH?

seancorfield 2026-03-25T14:02:43.517949Z

What do you mean? An outage?

ray 2026-03-25T16:03:58.658499Z

It was failing a while ago

teodorlu 2026-03-25T15:33:00.088949Z

just spent 15 minutes staring at this, just being confused. Am I catching it wrong? is ExceptionInfo not an Exception??

(try (map inc "confused")
     (catch Exception _ :exception-caught))
;; => Error printing return value (ClassCastException) at clojure.lang.Numbers/inc (Numbers.java:137).
;;    class java.lang.Character cannot be cast to class java.lang.Number (java.lang.Character and java.lang.Number are in module java.base of loader 'bootstrap')
(spoiler in thread)

imre 2026-03-26T08:36:25.897939Z

2 arg mapv is eager, higher ones just call map underneath

reefersleep 2026-03-26T11:38:51.336089Z

Do the lazyness issues apply even when the resulting value is eager? The 3 arg version, for example, is

([f c1 c2]
     (into [] (map f c1 c2)))
Which issues to do with lazyness could occur here? Ah... reads https://clojure-goes-fast.com/blog/clojures-deadly-sin/ again some stuff like dynamic binding can break

imre 2026-03-26T11:43:02.945039Z

Also, performance

teodorlu 2026-03-25T15:33:18.976269Z

lazyness and exceptions don't mix well!

teodorlu 2026-03-25T15:35:08.203949Z

There's no end to this rabbit hole!

(def x (list 1 2 (map inc "lol")))

;; first time
x
;; => (1Error printing return value (ClassCastException) at clojure.lang.Numbers/inc (Numbers.java:137).
;;    class java.lang.Character cannot be cast to class java.lang.Number (java.lang.Character and java.lang.Number are in module java.base of loader 'bootstrap')

;; second time
x
;; => (1 2 ())

teodorlu 2026-03-25T15:35:42.125149Z

@alexyakushev’s https://clojure-goes-fast.com/blog/clojures-deadly-sin/ comes to mind.

seancorfield 2026-03-25T15:39:13.085219Z

(map inc "confused") succeeds and returns a lazy sequence. When you print it (in the REPL), it attempts to realize the sequence and that is when it tries to (inc \c)

seancorfield 2026-03-25T15:40:28.382399Z

Also ExceptionInfo is-a Exception is-a Throwable:

user=> (ancestors (class (ex-info "" {})))
#{clojure.lang.IExceptionInfo java.lang.Object java.lang.RuntimeException java.io.Serializable java.lang.Throwable java.lang.Exception}

πŸ‘ 1
teodorlu 2026-03-25T15:41:08.428039Z

Yup, I realized at last!

teodorlu 2026-03-25T15:41:44.110599Z

Was meant as a brainfart to share, hence "(spoiler in thread)" in the original post. Very small at the bottom.

seancorfield 2026-03-25T15:50:17.532099Z

I've long wished that Clojure's "stdlib" was eager-by-default from day one, with lazy fns as "day two" stuff and opt-in.

πŸ‘ 1
☝️ 1
Ben Sless 2026-03-25T15:50:38.417299Z

Laziness is like a little surprise for yourself for later ☺️

πŸ₯ 3
πŸ˜‚ 2
borkdude 2026-03-25T16:05:45.434789Z

maybe something clj-kondo could help with

πŸ€” 2
imre 2026-03-25T20:51:27.793299Z

Shameless plug https://github.com/imrekoszo/unlazy

πŸ‘ 2
reefersleep 2026-03-26T06:08:54.121289Z

@imre mapv is lazy? But it returns a vector?

reefersleep 2026-03-26T06:16:10.010489Z

I must say, in spite of the good arguments for avoiding lazyness, it has bitten us surprisingly little at $workplace

Ben Sless 2026-03-26T06:19:12.368659Z

Mapv for varargs is slightly pathological

teodorlu 2026-03-27T09:29:58.398489Z

I converted my failings to a Clojuredocs example: https://clojuredocs.org/clojure.core/try#example-69c3ff007955605a202df29a Hope it's understandable!

πŸ’ͺ 1
πŸ’ͺ🏻 1
Thomas Moerman 2026-03-25T16:39:26.330039Z

😍 1
πŸ₯° 1