Fork me on GitHub
#clj-kondo
<
2023-06-23
>
Ben Lieberman19:06:38

Hi, I'm getting an invalid-arity warning when using rand-int inside swap!. I don't think there's anything wrong with my usage though.

seancorfield19:06:37

What does the code look like?

Ben Lieberman19:06:47

(swap! rand rand-int 11)

Ben Lieberman19:06:07

It says rand-int expects two args?

Ben Lieberman19:06:46

I ended up switching to reset! but this seems like an incorrect lint

seancorfield20:06:57

rand-int expected one argument so it cannot be used with swap!

seancorfield20:06:46

(swap! my-atom f arg) runs (f @my-atom arg) essentially. So you're trying to call (rand-int @rand 11) which is not valid.

Ben Lieberman20:06:11

I see. That makes sense. And yeah I screwed up that message. My bad.

Ben Lieberman20:06:38

Some days reading comprehension is not my long suit