This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-09
Channels
- # beginners (205)
- # boot (6)
- # cider (22)
- # cljs-dev (41)
- # cljsrn (4)
- # clojure (97)
- # clojure-dev (61)
- # clojure-greece (40)
- # clojure-italy (8)
- # clojure-russia (16)
- # clojure-spec (18)
- # clojure-uk (34)
- # clojurescript (14)
- # community-development (1)
- # cursive (45)
- # datomic (39)
- # fulcro (66)
- # jobs (2)
- # lein-figwheel (1)
- # lumo (9)
- # off-topic (8)
- # parinfer (98)
- # portkey (8)
- # re-frame (81)
- # reagent (54)
- # remote-jobs (17)
- # ring (2)
- # shadow-cljs (217)
- # spacemacs (32)
- # sql (24)
- # test-check (6)
- # unrepl (73)
- # yada (12)
I wanted to split my project into a muti-project I am able to split the CLJS files into a separate project, then build it(create jar) and add it as a dependency in my main project Now I am struggling with two things 1) Can I split the generic less files also into a generic project ? We have a generic CSS framework which are not tied to the components, so the project will just contain less files. 2) In my multi project, when I update the sub project CLJS files, I dont want to go through the entire deploy and import process. I tried the checkouts folder which is mentioned in the lein docs, but its not working for me https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md#checkout-dependencies
How can I get a map from a vector of maps based on value of a key? {:data [{:id 1 :b 2 :c "some string"} {:id 2 :b 4 :c "some other string string"} ...]}
How can I extract for example {:id 1 :b 2 :c "some string"}
By the value of the key :id
I feel like an idiot for asking but I could not find anything remotely usefull on google... 🤐
some
returns a truthy value as long as there is at least one value in the collection for which the predicate is true. It just so happens to return the first matching element as that truthy value
Alternatively, you could do something like:
(first (filter #(= 1 (:id %)) vec-of-maps))
Since filter is lazy, it will only process up until the first value found. I prefer some
, however. It's a bit more concise, and I think I've run into issues with filter or other similar transducers processing batches of data (so you may process more elements than you actually consume sometimes)