Fork me on GitHub
#cursive
<
2021-07-27
>
indy08:07:40

Is there a workaround for structural search for Clojure? I want to find usages of an overloaded function that is called with x number of arguments. A regex grep will be a pain, since I'll have to handle new lines and threaded forms.

cfleming10:07:18

No, there isn’t unfortunately. Searching for a particular arity is something that has been requested before.

indy10:07:01

Okay, thank you.

dpsutton14:07:27

https://github.com/borkdude/grasp allows you to "grep" a codebase with specs that include arity counts

emccue14:07:32

It is sort of sidestepping the problem, but the easier migration would be to move all usages of the function to using a map with named params

emccue14:07:52

that way you don't need to narrow down anything and in the future you can search for the map's keys for future revisions

indy14:07:20

I actually found an example that I can very easily build on https://github.com/borkdude/grasp/blob/master/examples/arg_vecs.clj. Thanks @U11BV7MTK

👍 2
indy14:07:55

@U3JH98J4R That's too big a diff, the function has 209 usages. And my need for refactoring is for quite a different purpose.

indy14:07:54

Since cursive uses static analysis to do it's thing and IntelliJ has a nice structural search, I was wondering if it was possible for Cursive to implement it for Clojure, but I'll hack around with grasp for now