This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-21
Channels
- # announcements (8)
- # babashka (12)
- # beginners (18)
- # biff (25)
- # calva (8)
- # clj-kondo (19)
- # clojure (53)
- # clojure-europe (3)
- # clojure-norway (3)
- # clojurescript (31)
- # emacs (9)
- # fulcro (12)
- # lsp (25)
- # membrane (1)
- # off-topic (58)
- # pathom (11)
- # pedestal (1)
- # proletarian (3)
- # re-frame (6)
- # releases (2)
- # shadow-cljs (7)
How do people typically set up clj-kondo in github actions? I'm considering https://github.com/DeLaGuardo/clojure-lint-action and wondering if anyone can vouch for it.
https://github.com/marketplace/actions/setup-clojure which has clj-kondo and some other nice tools too
That is the main feature I'm looking for. I have a project that can already run CI builds and tests, but I just need something to run clj-kondo and display its warnings near offending lines in PRs and what not
https://github.com/nnichols/clojure-lint-action uses clj-kondo with reviewdog which will comment issues in the PR where they occur
This is a list of GitHub actions I commonly use for Clojure projects https://practical.li/engineering-playbook/continuous-integration/github-actions/
@U0479UCF48H FWIW, I'm using that clojure-lint-action on clj-kondo's repo itself and it displays errors nicely
hi how to convert (def aa (io/input-stream ...)) byte/binary into string
thanks
how to get as string from input-stream /binary data
Hello! I’m developing clojure in my free time because my employer uses JS and Java. However, I would like to get a lot more practice and I was wondering how other people find room to develop in their free time, especially with a family. Do you always have your laptop ready to go or do you have some mobile development setup with your phone?
Hey @UPJP9G4G1 this is a really interesting question and I think you could spark a fruitful discussion. But do you mind deleting it from this channel and asking in #C03RZGPG3 ? We try to keep this channel a bit focused on technical bits and encourage the more conversational questions there. Thanks
Hello! Is that a simple, cross-platform way to check for a lazy seq? I have been burned before by logging a lazy seq and getting the useless clojure.lang.LazySeq@zdcqe1
in my logs so I want to force it into something that prints nicely. Currently I do
(cond-> input (instance? #?(:clj clojure.lang.LazySeq :cljs cljs.core/LazySeq) input) vec)
🙏Look here: https://github.com/didibus/special/blob/faster-and-more-correct-eagerization/src/special/eagerize.cljc You can copy some of this. Basically make a protocol like Eagerizable, and then just extend types to it.
Calling eagerize will then realize anything. So no matter what you log, it will get realized and logged.
I'll probably turn it into a small library some day, but for now you can just copy/paste the code
What are you using to print values? It seems like if you want to change how the value is printed, then you should modify/change the printer rather than modify/change the value.
I am using taoensso.timbre/info
Thank you, didibus, I will have a look!
timbre offers config and middleware so you can augment how values are logged. that would allow you to fix how values are printed in one place.
Thank you! I did not know that
I'm choking a bit with a macro here, I'm inside of unquote and want to return code that also uses unquote?
(let [expr false]
`(foo `(bar ~expr)))
and I want:
(foo `(bar false))
Maybe, but I'm doing something quite tricky. A macro that returns if the compiler thinks the return value of a form is primitive
Shouldn't this error:
(loop [i 0]
(if (= i 0)
(recur "hello")
i))
Because the primitive local type was rebound to a different type?
> • recur forms that rebind primitive locals do so without boxing, and do type-checking for same primitive type.That's not valid syntax, it says: > Can't type hint a local with a primitive initializer
(set! *unchecked-math* :warn-on-boxed)
;; emits warning
(loop [ i 0]
(case i
0 (recur "hello")
"hello" (recur 1)
1 (inc i)))
;; does not emit warning
(loop [ i 0]
(case i
0 (recur 1)
1 (inc i)))
Ya, which contradicts the docs, because instead of type-checking for same type, it infered Object ?
do you have a link to the docs you're referring to?
So in what scenario would we get a type-check error here? By the way, I'm pretty sure I've seen recur complain about wrong type before, but now am confused how to repro or when it would do so
it doesn't say that it gives a type check error. it says it checks the type, which you can see with (set! *unchecked-math* :warn-on-boxed)
So this is just saying it would make it Object if you were to rebind to a different primitive type?
The warn on box is different, like take this:
(loop [i 0]
(if (= i 0)
(recur false)
i))
Why no warn?It doesn't say it makes it Object. it says that it rebinds primitive locals without boxing when the type checks out
unchecked-math only warns on boxed math. your example doesn't have boxed math
No, it says it does type checking for SAME primitive type: > and do type-checking for same primitive type
It's not really clear what you're trying to do
I also remember getting this error many times, and you need to cast, because you're like rebinding a double into a long for example.
I guess I was under the impression, because I remember getting the error before, that if you recur and change the primitive type of the local, Clojure errors. I remember getting this error a few times before. And then I went looking again, and saw that it is mentioned in the doc. But I wasn't able to see this behaviour.
Knew it:
(loop [a (byte 0)]
(if (= a 0)
(recur (long 1))
a))
Caused by java.lang.IllegalArgumentException
recur arg for primitive local: a is not matching primitive, had: long,
needed: byte
So it seems it only does it for certain combination of types, but not for all change in the type. Weird
(loop [a (short 0)]
(if (= a 0)
(recur "hello")
a))
Caused by java.lang.IllegalArgumentException
recur arg for primitive local: a is not matching primitive, had:
java.lang.String, needed: short