This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-04
Channels
- # announcements (13)
- # beginners (51)
- # boot (3)
- # calva (10)
- # cider (20)
- # clj-kondo (55)
- # cljs-dev (60)
- # clojure (99)
- # clojure-europe (6)
- # clojure-gamedev (9)
- # clojure-italy (19)
- # clojure-nl (7)
- # clojure-spec (20)
- # clojure-uk (42)
- # clojurescript (96)
- # clojurex (37)
- # clojutre (1)
- # cursive (37)
- # data-science (2)
- # datomic (15)
- # defnpodcast (9)
- # duct (7)
- # emacs (6)
- # events (9)
- # fulcro (124)
- # jackdaw (4)
- # jobs (4)
- # leiningen (9)
- # malli (7)
- # mount (3)
- # off-topic (109)
- # other-languages (8)
- # re-frame (39)
- # reagent (4)
- # reitit (6)
- # remote-jobs (2)
- # rewrite-clj (36)
- # ring (4)
- # shadow-cljs (16)
- # spacemacs (16)
- # tools-deps (91)
- # vim (8)
- # yada (2)
@UAEH11THP Most often by making a new reference (aka pointer) to that value from a data structure added to the map.
An immutable value can have an arbitrary number of references to it from dozens or hundreds of places, which is perfectly fine since it is never going to change its value.
If you would like to generate pictures of what some of these data structures look like in memory, I created a library called cljol that can do so: https://github.com/jafingerhut/cljol . Its 'gallery' has some figures created using the library: https://github.com/jafingerhut/cljol/blob/master/doc/README-gallery.md
Hello everyone! I'm trying to call a function with 4 pairs of arguments, and I'm looking for a more idiomatic way to do it than this:
(do-something "A" :a)
(do-something "B" :b)
(do-something "C" :c)
(do-something "D" :d)
I kind of want it to look something like
(<thing-im-looking-for> do-something ("A" :a "B" :b "C" :c "D" :d))
but it looks like I should be able to do this:
(doseq [char ["A" "B" "C" "D"]
key [:a :b :c :d]]
(do-something char key))
I got it (edited with @schmee's correction below):
(doseq [[char key] [["A" :a] ["B" :b] ["C" :c] ["D" :d]]]
(do-something char key))
nice! should be an extra pair of brackets though:
(doseq [[char key] [["A" :a] ["B" :b] ["C" :c] ["D" :d]]]
(do-something char key))
also, are you using this for something side effect-y or do you need the results of do-something
?
hi everyone : struggling with vase here. I am using 'lein new vase service' to try the template out, but then if I follow the readme, 'lein repl' then (def srv (run-dev)) doesn't work, compiler saying it can't resolve run-dev in this context (I am in the right ns though!). What am I doing wrong?
What are you using to switch to the correct namespace? You should be calling in-ns
and not ns
.
thanks for your feedback. I found it was a known issue with the template and have since moved on to starting using updated samples. But there as well I ran into an issue while trying to use datomic-pro instead of datomic-free using the deps as in samples using datomic-pro, but I get a Failed to construct terminal error...
‘9 is the number 9, the latter is a symbol that prints as 9. Symbols are not equal to numbers.
‘ means read but don’t evaluate the next thing. 9 is read as the number 9
Numbers (like almost everything in Clojure) evaluates to itself though
Quoting is mostly only useful on the exceptions to that - symbols and lists
In evaluation, symbols do a lookup to what they refer to, lists invoke the first element using the rest as args
Okay, I guess I got it, every primitive is read as the primitive itself but if it is anything else it is a symbol
Well not everything, but mostly yes
👋 what's a good book to learn clojurescript and functional paradigms in general?
thank you!
Hi everyone! Is there a way in clojure to wait for a vector of promises and do something once all promises have returned?
There is also alts! in core.async https://clojuredocs.org/clojure.core.async/alts!
@gerome.bochmann You could map eagerly with run!
, mapv
, (dorun (map ... ))
or (doall (map ...))
, calling deref
on every promise. For example:
(run! deref promises)
;; Then <do something>