This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-06
Channels
- # adventofcode (10)
- # ai (2)
- # aleph (2)
- # announcements (21)
- # beginners (25)
- # calva (7)
- # cider (19)
- # clj-kondo (28)
- # clj-on-windows (3)
- # cljdoc (6)
- # clojure (80)
- # clojure-dev (15)
- # clojure-europe (29)
- # clojure-italy (3)
- # clojure-nl (37)
- # clojure-uk (4)
- # clojurescript (3)
- # cloverage (1)
- # conjure (6)
- # core-async (2)
- # cursive (17)
- # datalevin (9)
- # datomic (7)
- # deps-new (23)
- # emacs (4)
- # figwheel-main (6)
- # fulcro (6)
- # honeysql (19)
- # improve-getting-started (4)
- # inf-clojure (2)
- # introduce-yourself (5)
- # jobs (1)
- # leiningen (6)
- # lsp (73)
- # malli (1)
- # nrepl (2)
- # off-topic (37)
- # polylith (9)
- # quil (2)
- # reitit (16)
- # releases (2)
- # remote-jobs (6)
- # rewrite-clj (38)
- # shadow-cljs (1)
- # tools-build (1)
Clj-kondo Sublime Text integration docs: https://github.com/clj-kondo/clj-kondo/blob/master/doc/editor-integration.md#sublime-text
![sublimetext](https://emoji.slack-edge.com/T03RZGPFR/sublimetext/c0ded479d07a615b.png)
sounds tough to discern the good case from (update x :foo #(bar a % b))
but i like that idea
I guess any such function (like swap!) where the update fn uses its argument in the second position of its singular form
This is probably doable. Up till 3 args this seems ok, but more than that it's going to use apply
which in some cases would affect performance somewhat? Depends on hot path of course
but the 99% common case is that beginners don't know about the update function taking multiple args
in fact a more generic lint would be if someone passes a function #(inc %) rather than inc
I’m trying to think of corner cases where it might be difficult to realize you can’t use this
(update x :foo #(bar a (merge % {:a :b}) b))
(update x :foo #(bar a (let [x %] (inc x)) b))
(update x :foo #(bar a (inc %) b))
(update x :foo #(bar a % %))
the rule would be: "anonymous arity-1 function of a single expression passed to swap/update, where the singular arg appears only in the second position in the form"
anonymous function that just forwards to a var:
(fn [x] (foo x))
or #(foo %)
rather than foo
I wrote an issue here: https://github.com/clj-kondo/clj-kondo/issues/1526