Fork me on GitHub
#cider
<
2024-04-01
>
TMac14:04:14

If I have a let like this:

(let [x 42
      y (* 2 x);
      z (/ y 10]
  (frobnicate z))
What's the best way of getting the value of (* 2 x) (or y)? Of course if I put my cursor on the ; and run cider-eval-last-sexp it'll complain about x being undefined. So far the best I've come up with is
(let [x 42
      y (* 2 x);
      z (/ y 10]
y #_  (frobnicate z));
and cider-eval-last-sexping from the end of the let, but I was wondering if there was a slicker way

vemv14:04:38

cider-enlighten-mode (which might be somewhat unmaintained, but still work - I rarely hear about it) shines with let and such intermediate values https://docs.cider.mx/cider/debugging/enlighten.html

vemv14:04:13

https://github.com/flow-storm/cider-storm is also a thing Finally, a simple approach can be to (doto ,,, tap>) and then cider-inspect the tapped value

jpmonettas17:04:52

there is also the crazy :

(let [x 42
      y @(def y (* 2 x))
      z (/ y 10)]
  (frobnicate z))

clojure-spin 2
anonimitoraf12:04:29

There’s also https://github.com/AbhinavOmprakash/snitch 😄 (although not CIDER-related per se)