This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-18
Channels
- # announcements (1)
- # babashka (16)
- # beginners (39)
- # calva (17)
- # cider (21)
- # cljs-dev (1)
- # clojars (2)
- # clojure (39)
- # clojure-australia (1)
- # clojure-europe (1)
- # clojure-spec (7)
- # conjure (1)
- # cursive (6)
- # datomic (2)
- # depstar (5)
- # graalvm (20)
- # instaparse (11)
- # meander (4)
- # pathom (4)
- # pedestal (3)
- # polylith (18)
- # re-frame (13)
- # reagent (4)
- # reitit (3)
- # shadow-cljs (2)
- # spacemacs (14)
- # vrac (1)
Do you mean by first evaluating it with cider-eval-defun-at-point
?
I do run that to define it right after writing it… that’s a habit; cider-eval-defun-at-point
on
(defn foobar [x]
(* x 2))
I can then evaluate it with
(foobar 2)
in my buffer once I’ve typed it out. But when I run it with cider-read-and-eval-defun-at-point
I get
Show: Project-Only All
Hide: Clojure Java REPL Tooling Duplicates (24 frames hidden)
2. Unhandled clojure.lang.Compiler$CompilerException
Error compiling *cider-repl scratch/project:localhost:3333(clj)* at (1:1)
#:clojure.error{:phase :compile-syntax-check,
:line 1,
:column 1,
:source "*cider-repl scratch/project:localhost:3333(clj)*"}
1. Caused by java.lang.RuntimeException
Unable to resolve symbol: foobar in this context
Util.java: 221 clojure.lang.Util/runtimeException
core.clj: 3214 clojure.core/eval
core.clj: 3210 clojure.core/eval
main.clj: 437 clojure.main/repl/read-eval-print/fn
main.clj: 458 clojure.main/repl/fn
main.clj: 368 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
AFn.java: 22 clojure.lang.AFn/run
AFn.java: 22 clojure.lang.AFn/run
Thread.java: 748 java.lang.Thread/run
I got really addicted to evaluating forms in this way so it’s hard to live without, now, lol.
Another clue to whatever I’m doing wrong: if I run cider-read-and-eval
and type out (foobar 2) in the minibuffer at the prompt, I get the same error.
You might open some ticket about this, as when I try both commands they work for me, so I assume you're not using them exactly as I do.
It’s all partly because I’m learning a lot so I have to check almost every function in isolation; I spend at least 30% of my coding time typing out these functions, running them in isolation with fake arguments, then deleting them or commenting them out.
That’s what it looks like to me. Unfortunately, I don’t know how to figure how to resolve it.
do I (ns)
int the cljs reple, or?
the cljs repl prompt is cljs.user>
if that’s useful.
I was able to switch my prompt to the namespace foobar is defined in and type it in with an argument and that worked.
my cljs.user> prompt, that is.
haha, didn’t think you were shouting… but, for the record, any of you can shout at me all day long… you all are angels so you can do no wrong.
Hi. I have the following set for cider
cider-repl-result-prefix ";; "
cider-eval-result-prefix ";; "
and when I do C-x C-e I get the ;;
in the overlay, but when I do C-u C-x C-e the results in my buffer aren't commented out. Can anyone recommend what variable I need to set to get this?