This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-19
Channels
- # aws (2)
- # babashka (4)
- # babashka-sci-dev (7)
- # beginners (92)
- # biff (7)
- # calva (64)
- # cider (2)
- # cljsrn (14)
- # clojure (8)
- # clojure-australia (5)
- # clojure-europe (14)
- # clojure-norway (8)
- # clojure-spec (36)
- # clojurescript (19)
- # component (15)
- # cursive (1)
- # data-science (6)
- # girouette (5)
- # hyperfiddle (3)
- # juxt (5)
- # leiningen (10)
- # lsp (7)
- # malli (12)
- # nbb (90)
- # polylith (1)
- # portal (11)
- # rdf (7)
- # reagent (6)
- # reitit (40)
- # remote-jobs (1)
- # shadow-cljs (21)
- # specter (5)
- # squint (83)
- # tools-deps (17)
- # vim (7)
So now I’m using re-frame and reagent, and when I C-x C-e
to update a function definition, I don’t see any update in the browser
I mean I don’t understand exactly how this should work — I think I have to call reagent-dom/render but I’m not sure how you call this ergonomically when working in emacs like this
This is probably a very newbie question, but is there an easy way to get the string representation of a javascript object representing a clojure hashmap? So if I have a hashmap like {:a "value"}
it gives me "{a: "value"}"
(this is for generating some javascript from clojure for something very hacky.
`❯ clj -A:cljs -M -m cljs.main -re node -r
ClojureScript 1.10.773
cljs.user=> (.stringify js/JSON (clj->js {:a 1}))
"{\"a\":1}"
so I'm 98% sure using for
here is totally wrong but also it halfway does what I want it do?
(defn ask-question? [q a]
(if (= (js/prompt q)
a)
true
false))
(for [[q a] q-and-a]
(try (ask-question? q a)
(catch ExceptionInfo e
(.log js/console e))))
But instead of letting me capture any output it throws clojure.lang.ExceptionInfo
which I can't catch or log for some reasonHow exactly do you run it? Seems to work just fine for me.
Also, no need for an if
if you return true or false - you can just return the condition.
Oh, also, yeah. clojure.lang.ExceptionInfo
is a Clojure thing, not a ClojureScript thing.
So that exception comes from your server, perhaps from the REPL process itself.
according to the stack trace map the :type
is :js-eval-exception
I am using cider-eval-last-sexp
Does a plain (js/prompt "?")
work like that?
If yes, then whatever Cider does probably can't handle that expression in a for
, just like David said outside the thread.
@U11BV7MTK @U2FRKM4TW I do get the prompts in the browser, which for whatever reason for
causes, but when I tried doseq
and some of the others like run
it doesn't
but also I'm very hazy with the various functions that trigger operations on seqs
@bhlieberman93 for
is not a loop
it’s a list comprehension thing. You should not use this for side-effects, if you need a imperative loop use something else