Fork me on GitHub
#off-topic
<
2021-11-04
>
dpsutton05:11:58

Does anyone remember two small functions that i think Rich Hickey wrote? They would take a var and one would return the functions called from the function referenced by that var, and the other would find all functions that used that var. Does that ring a bell?

phronmophobic05:11:30

the functionality sounds sorta like codeq, https://blog.datomic.com/2012/10/codeq.html , but it's not two small functions

dpsutton05:11:29

yeah. i think there's some stuff. but i remember rich just tweeted them out or shared them here. And they were incredibly straightforward and smart, and did so much work that other tooling could accomplish with 1000s of lines of code

🆒 1
phronmophobic05:11:44

that sounds neat. hope someone can find a reference

dpsutton05:11:51

i suspect i can think of 3 people who would probably know and hopefully they might remember if they see this

seancorfield06:11:55

@U11BV7MTK I think something like that is built into REBL? I seem to recall some sort of dynamic call tree/var reference thing from that. I do remember part of the code being shared but I don't remember exactly where...

seancorfield06:11:21

That includes some of Rich's code. Is that what you're looking for?

dpsutton06:11:01

yes i think that is it!

dpsutton06:11:39

and yeah it was when rebl came out and he was like "it's really not hard" haha. and bbatsov snapped it up and threw it into CIDER. it's got more nrepl stuff mixed in as well though

dpsutton14:11:47

yeah that's what i mean. there's a LOT of work powering that. and this quickly just cranked it out in a very clever way

sova-soars-the-sora18:11:12

looks like a tip of the hat to java interop / jvm reflection

Max14:11:45

Are there any decent standalone tools for formatting EDN? Ideally available as a VSCode extension or in a website? I frequently find myself pulling and inspecting big single-line EDN structures out of logs. With JSON, I can just tell VSCode to format the document, but cljfmt (used by Calva) doesn’t break up lines, and it seems to struggle without an available REPL, and it seems silly to start a REPL just to format something

pez16:11:21

The Calva formatter is fully static, so no REPL needed. But yes, it does not break things up into lines.

Max17:11:33

Seems like there’s a niche for a standalone EDN extension with a formatter, or to allow calva to more aggressively format non-code

pez17:11:31

jet doesn’t care if it is code or EDN, does it?

pez17:11:22

I’m thinking a combo of jet + cljfmt might work nicely in Calva. (cljfmt would mainly make things adhere to whatever .cljfmt.edn rules in the project.

mauricio.szabo14:11:39

@max.r.rothman I think zprint does this (breaks into lines if it get too big), but it's a little hard to customize. Give it a try 🙂

rwstauner23:11:45

there is also cljstyle which is like cljfmt but graal compiled so it boots fast (no repl needed)

borkdude14:11:10

@max.r.rothman There is jet which you can use like this: cat foo.edn | jet --from edn --pretty and it will pretty print the EDN. You can also apply a query or function to the incoming EDN. If you need additional formatting options perhaps use cljfmt, zprint , puget and the likes. Jet: https://github.com/borkdude/jet I've got a puget CLI here: https://github.com/borkdude/puget-cli

Proctor18:11:53

Idea for a new clojure library `preach`, it goes and generates some generative tests for all your functions with `pre` /`post` conditions or those with a `spec` on them, and testifies that your code meets those invariants… 😄

Proctor18:11:01

Because I can never pass up a good pun

Lennart Buit20:11:09

There is this joke language named ‘vigil’. It’s a python dialect that outright deletes code that doesn’t adhere to its contract

Proctor20:11:11

that actually sounds kind of awesome….