clj-kondo 2025-02-19

First time writing a hook... what's a decent way to rewrite something as (let [foo ???]) where the type of ??? is unknown

All I want to achieve here is that foo is bound ... but not to be inferred as anything in particular

If I understand what you want to do, wrapping the right side in identity should do

Oh I see that done elsewhere as well, common idiom?

Is it (let [foo identity]) or (let [foo (identity ???)])

second one of course

👍 that works thank you!

Why do you want to expand in a let? You could also expand into (fn [foo]) perhaps, where the argument type is unknown

Kind of just hacking on something to learn how to use it... could you tell me more about rewriting a node as a fn? Lets say I have...

(my-macro [foo :bar]
  (prn foo)) 
:bar is just some magic key that references something else far away... So I can rewrite this as... to at least have foo marked as a binding and being used
(let [foo (identity :bar)]
  (prn foo))
I'm not sure how I would rewrite it as (fn [foo] ...) instead

Well I mean I know how to do it but not sure what it means to put an uncalled fn somewhere

right, makes sense