I was just looking at the types for the *-in core functions, and noticed that the second arg (which is nearly always a vector in real code) is marked as seqable rather than sequential . I’m pretty sure there isn’t, but can anyone think of legit code where you’d use a seqable but not sequential second arg? The compiler and runtime are happy with these because they are seqable, but they rarely return anything:
(get-in {:a {:b 42}} {:a :b})
;; => nil
(get-in {:a {:b 42}} #{:a :b})
;; => nil
(get-in {:a {:b 42}} ":a:b")
;; => nil
and when they do, it feels like more luck than judgement:
(get-in {:b {:a 42}} #{:a :b})
;; => 42
(that succeeded because the hash order of those set constituents happens to match a valid path in the map)
If not, I suggest we tighten up the type to :sequential or :nilable/sequential (thoughts?)Sequential probably makes more sense for clj-kondo
Just found this:
(get-in {\a {\b 42}} "ab")
;; => 42
but likewise, can’t believe anyone actually relies on thisi’ll make a quick PR
we'll see in the regression suite :)
One more, just for anyone reading who likes hideous code 😏 :
(get-in {[:a :b] {[:c :d] 42}} {:a :b :c :d})
;; => 42regression suite is clear, so feels like a safe change. https://github.com/clj-kondo/clj-kondo/pull/2726