This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-09
Channels
- # announcements (19)
- # babashka (26)
- # beginners (157)
- # calva (54)
- # cider (12)
- # clj-kondo (18)
- # cljdoc (3)
- # clojure (65)
- # clojure-australia (3)
- # clojure-europe (28)
- # clojure-germany (14)
- # clojure-greece (1)
- # clojure-italy (8)
- # clojure-nl (10)
- # clojure-uk (81)
- # clojuredesign-podcast (2)
- # clojurescript (20)
- # clr (1)
- # conjure (1)
- # cursive (1)
- # data-science (29)
- # datascript (2)
- # datomic (19)
- # depstar (4)
- # fulcro (24)
- # graalvm (6)
- # helix (26)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (12)
- # leiningen (1)
- # malli (17)
- # off-topic (18)
- # pathom (34)
- # polylith (23)
- # re-frame (10)
- # reagent (8)
- # releases (1)
- # remote-jobs (1)
- # reveal (5)
- # shadow-cljs (49)
- # spacemacs (1)
- # startup-in-a-month (6)
- # vim (4)
I'm sure this comes up all the time, but I couldn't find a simple explanation - by what process can I get output of prn
/`pprint` etc in my repl, and not the browser console? I guess something has intercepted this..?
By default they should print out in your REPL. The redirection to the browser console is usually done explicitly by calling (enable-console-print!)
.
So either that function is called somewhere in your code or it's called by something in your setup. Or maybe the print function is set directly with set-print-fn!
.
In any case, the answer to your question depends on your setup and your code. Impossible to say anything without knowing about those two.
thanks @U2FRKM4TW - assuming something is calling this, is there a way to get the current repl as a print target to override that call later?
The value that you have to pass to those set-*-fn!
functions depends on your particular REPL. The default CLJS browser REPL that you start with cljs.main
uses clojure.browser.repl/repl-print
.
I guess shadow has its own location for the repl - clojure.browser.repl/repl-print
appears to be undefined
Hello there,
I am having little problem,
So I have array of :tasks [{:unitid 1} {:unitid 2}]
and so on, which is pulled from api and stored as state.
How do I add more objects into this ? I tried doing the following but it just overrides it.
I tried doing (swap! State* assoc :tasks {:test 1} )
Result is :tasks {:test 1}
Can someone please tell me whatโs going on?
I would like my results to be :tasks [{:unitid 1} {:unitid 2} {:test 1} ]
ignore the atom. assoc
takes a map, a key, and a value and returns the map with that key value pair added to it. (assoc {:a :b} :a :new)
will return {:a :new}
. If you want to modify a map as you're intending you want to use update
. In this case (update {:a [:b]} :a conj :new)
will yield {:a [:b :new]}
. Putting this together with the atom functions: (swap! State* update :tasks (fnil conj []) {:test 1})
should do what you want. I'm using fnil
to handle if there's not already a value present with that key to use []
instead of nil