This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-17
Channels
- # beginners (70)
- # boot (4)
- # cider (16)
- # clara (6)
- # cljdoc (21)
- # cljs-dev (2)
- # cljsrn (1)
- # clojure (73)
- # clojure-finland (2)
- # clojure-nl (6)
- # clojure-russia (35)
- # clojure-sg (1)
- # clojure-spec (14)
- # clojure-uk (146)
- # clojurebridge (2)
- # clojurescript (128)
- # cryogen (2)
- # cursive (20)
- # datomic (27)
- # emacs (6)
- # events (8)
- # figwheel-main (57)
- # fulcro (46)
- # hoplon (3)
- # hyperfiddle (2)
- # immutant (3)
- # jobs (6)
- # jobs-discuss (15)
- # juxt (2)
- # off-topic (33)
- # parinfer (2)
- # portkey (4)
- # protorepl (1)
- # re-frame (4)
- # reagent (78)
- # ring-swagger (45)
- # schema (6)
- # shadow-cljs (167)
- # spacemacs (2)
- # specter (13)
- # tools-deps (6)
Simple question - I want to collect a set of keys from a nested map (but not all the keys - is there a simple way to do this?
@mmer if you just want to filter by a predicate you can do (select [MAP-KEYS even?] {1 :a 2 :b 3 :c 4 :d}) ;; => [2 4]
As always happens with this - getting back into using after a while can be brain twisting - I want to do a conditional collect. I want to collect something based on a child map containing a certain key
Also is there an easy way to select a map entry that has a certain key no matter where in a deeply nested data structure it is?
@mmer do you have specific examples of what you're trying to do? It varies depending on the specifics
I am working over a yaml datastructure. I would like collect the name of the yaml item if the structure contains an item called "tag" , I also need the content of the tag.
Interesting side point - until you asked this question I was unaware of the nastiness of the extra vectors as inmost case specter just did what I expected! --fantastic. Just these odd cases
@mmer is that map in the input supposed to be a vector?
and by nested anywhere inside, you mean any one of those inner vectors could repeat the top-level structure?
The input structure could be contained anywhere in a larger structure and yes that should be a map - sorry
@mmer do you have an example of a more deeply nested structure?