Fork me on GitHub
#gratitude
<
2022-10-03
>
genekim03:10:58

Ever want to add a dependency, but hesitated or delayed doing so, because it would require having to restart your REPL? I just tried lambdaisland/classpath, which scans your deps.edn, and magically updates your classpath: it’s incredible that I could add data.json and darkstar to deps.edn, and actually use them just by reloading a namespace. Surreal! Thank you @plexus and all!

seancorfield04:10:51

Or, you know, you could just use https://github.com/clojure/tools.deps.alpha/tree/add-lib3 which is what I've been using for ages 🙂

2
seancorfield05:10:14

See https://github.com/seancorfield/dot-clojure/blob/develop/deps.edn#L102 for more detail. I have a hotkey in Calva to load deps from deps.edn into a running REPL. No restarts needed.

Chris08:10:12

is there anything similar for leiningen?

borkdude09:10:54

> Ever want to add a dependency, but hesitated This is probably a good thing: adding dependencies should be done with hesitation 😁

☝️ 1
😆 3
pez09:10:03

> is there anything similar for leiningen? I don't think we have something hot-reload style as in OP. But https://github.com/clj-commons/pomegranate looks pretty similar to the add-libs approach that @U04V70XH6. You could configure your editor to let you have your cursor in a dependency coordinate and then evaluate the necessary pomegrenate form to install it in your REPL. (I think, I haven't actually tried pomegrenate.)

brianwitte20:10:25

Grateful for the “thread-first” macro ->; I must confess that I was writing Clojure for about over a month before I found it. It was like a new pair of glasses when it came to reading my code…

💯 10
gratitude 10
russmatney20:10:19

I love the thread first -> and thread last ->> macros - I've found they make for code that is quite amenable to change, when you come back to tweak/add/remove part of the pipeline.

🤝 1
1
borkdude21:10:25

Especially nice with Java(Script) interop

1
2
pez21:10:55

It's good to know that your editor probably has a command for evaluating the thread up to the cursor. So if we represent the cursor with | and issue this command:

(-> 40| => 40
    +| => 41
    +| => 42
    (str "!!!"))
In Calva this is by default bound to ctrl+alt+enter.

🤯 4
gratitude 3
russmatney21:10:22

excellent tip @U0ETXRFEW! had no idea this was a thing - in cider/emacs it's cider-eval-sexp-up-to-point (which happens to be C-c C-v C-o in my doom emacs setup)

1
metal 1
gratitude 1
souenzzo23:10:19

is composable with ->>, as-> and doto 🙂

(-> 2
  (doto prn) ;; => 2
  (->> (/ 84)
  (doto prn) ;; => 42
  (as-> % (< 40 % 50))
   (doto prn) ;; => true
)

metal 4
borkdude21:10:50

Shout-out to @ericdallo @jacob.maine and @snoe for clojure-lsp! clojure-lsp gratitude

gratitude 17
clojure-lsp 9
💜 8