Fork me on GitHub
#off-topic
<
2022-07-27
>
timo12:07:12

A while ago someone started some initiative for climate- and environment-related clojure-jobs and things alike. I can't find it anymore. This still alive? Where?

Benjamin17:07:05

I desire a tool that

(let [foo (get-foo)
        bar (get-bar foo)]
    ..
    )
lets me hover on "foo (get-foo)" eval and def it. Really just quickly doing (def foo (get-foo)) which is what I currently do

Benjamin17:07:05

as the next thing,

(let [_ (def foo (get-foo))
        _ (def bar (get-bar foo))]
    ..
    )
turn it into this

vemv17:07:31

you use emacs IIRC?

Benjamin17:07:05

currently not lol I thought you asked emacs irc. Yes emacs

phronmophobic17:07:20

It turns out that you can be even more aggressive about evaling clojure code since it's mostly pure and lazy

šŸ˜® 1
phronmophobic18:07:17

Do you want to def because you want to see the value or because you want to use the value somewhere else? What editor are you using?

Benjamin18:07:11

emacs and I might want to do more than seeing

phronmophobic18:07:01

you can view the value with M-x cider-inspect or C-c M-i . once you view it, you can optionally def with M-x cider-inspector-def-current-val or d in the inspector view.

phronmophobic18:07:22

obviously, you can streamline it as much as you like with a bit of elisp

seancorfield18:07:38

I have a key binding in VS Code that if you highlight the symbol and expression in a let binding, it will def that for you as a global. It's a custom REPL snippet that evals (def $selection) so it's pretty mindless.

seancorfield18:07:32

I can put the cursor in front of the symbol and do ctrl+shift+right ctrl+shift+right ctrl+alt+space d

borkdude19:07:25

@U04V70XH6 sounds cool, is this supported by Calva or did you write some joyride code?

seancorfield19:07:34

It's a custom REPL snippet so it's "just" Calva. My only two Joyride scripts right now are to display Clojure/Java documentation directly in VS Code (via the built-in Simple Browser).

seancorfield19:07:52

If Joyride could auto-sync scripts between machines somehow, I'd convert more of my custom REPL snippets to run Joyride scripts (so I could use code for the more complex ones instead of "just strings").

šŸ‘ 2
borkdude19:07:46

Perhaps a git repo in your home dir? :)

seancorfield20:07:41

Meh, I already have that and manually sync those Joyride files. But I like the convenience of editing a custom REPL snippet on one machine and having it just work automatically on another machine "immediately" šŸ™‚

jumar03:07:16

@U02CV2P4J6S you said you are not currently using emacs and, at the same time, that your editor is Emacs? šŸ™‚. Anyway, as already mentioned, cider inspector can do that and you can also use it while https://docs.cider.mx/cider/debugging/debugger.html There are also tools like these that can do that for you: ā€¢ https://github.com/Saikyun/miracle.save ā€¢ https://github.com/vvvvalvalval/scope-capture Finally, you can use a simplo macro to do the job: https://github.com/jumarko/clojure-experiments/blob/master/src/clojure_experiments/debugging.clj#L80-L99

(defmacro locals []
  (let [ks (keys &env)]
    `(let [ls# (zipmap '~ks [~@ks])]
       (println "====================== DEBUG locals =======================")
       (clojure.pprint/pprint ls#)
       (println "====================== END DEBUG locals =======================")
       (def my-locals ls#))))

Benjamin07:07:07

thanks I check it! @U06BE1L6T I use emacs but not irc -- a lol I just misunderstood

Phani Mahesh13:08:56

@U7RJTCH6J what is that gif from?

phronmophobic13:08:43

@U03DPUQ1LJV, it's an experimental tool that I'm working on