Fork me on GitHub

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?


Not sure I can share that - don't worry about it I will keep going. I am making progress in other areas. Thanks.