cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
lepistane 2021-06-22T10:41:12.165600Z

hello i can't seem to find the command that i found very interesting in calva. Since calva is built on top of cider i assumed it would be there. Calva has ctrl +alt + enter which in threaded expression does this (look at the image). i haven't been able to find this for cider. Is there a command for this? edit is it C-c C-v z?

tvirolai 2021-06-22T10:48:41.166Z

Do you mean cider-eval-sexp-up-to-point (C-c C-v C-o)?

lepistane 2021-06-22T10:50:46.166200Z

yes it seems to be that! let me ask u this. Why do i get same behavior with C-c C-v z cider-eval-defun-up-to-point and command u suggested ?

tvirolai 2021-06-22T10:56:36.166400Z

If I'm not mistaken, the latter is more specific, operating only for functions, while the former is more generic and it should evaluate any form up to the point.

lepistane 2021-06-22T10:56:58.166600Z

makes sense. thank you!

bozhidar 2021-06-22T12:12:06.166800Z

defun in CIDER simply means a top-level form.

bozhidar 2021-06-22T12:12:25.167Z

It doesn’t necessarily have to be a definition of any kind.

👍 1
bozhidar 2021-06-22T12:13:40.167400Z

See also https://docs.cider.mx/cider/1.1/usage/code_evaluation.html

pez 2021-06-22T14:37:49.167600Z

The defun up to point is interesting. I assume you’ll have to close all open brackets in order for it to evaluate, @bozhidar? (Yes, planning to steal this one too. 😃 )

bozhidar 2021-06-22T14:42:11.167800Z

Yep, the command appends the missing parens prior to sending this out to be evaluated.

bozhidar 2021-06-22T14:42:41.168Z

I finally needed to implement the classic stack exercise of balancing parentheses for a practical purpose. 😄

😁 1
pez 2021-06-22T14:42:47.168200Z

For clarity about built from CIDER. That has two aspects to it. One is quite literally built on CIDER/Orchard infrastructure as I explain a bit in this presentation: https://www.youtube.com/watch?v=NIk5hVzA_fY The other is “heavily inspired from” which goes for a lot of the static services, to which the feature in OP, perhaps surprisingly, belongs. (Even if cider-nrepl is used for carrying out the evaluation, grabbing the right things to evaluate is a static thing, for which Calva has its own infrastructure.

pez 2021-06-22T14:44:21.168500Z

> I finally needed to implement the classic stack exercise of balancing parentheses for a practical purpose. Thanks. I was just about to ask. 😃 I might go that route too.

pez 2021-06-22T14:46:38.168700Z

I have that functionality, as it happens. For the rainbow parens. But I think I might find it hard to tease it out of there. But, then again, maybe not. We’ll see.