specter

Latest version: 1.1.3
mmer 2018-08-17T10:00:31.000100Z

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?

nathanmarz 2018-08-17T12:55:47.000100Z

@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]

mmer 2018-08-17T13:25:22.000100Z

Thanks

mmer 2018-08-17T13:28:38.000100Z

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

mmer 2018-08-17T13:30:36.000100Z

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?

nathanmarz 2018-08-17T13:54:07.000100Z

@mmer do you have specific examples of what you're trying to do? It varies depending on the specifics

mmer 2018-08-17T14:01:37.000100Z

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.

mmer 2018-08-17T14:02:59.000100Z

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

nathanmarz 2018-08-17T14:11:03.000100Z

@mmer is that map in the input supposed to be a vector?

nathanmarz 2018-08-17T14:11:29.000100Z

and by nested anywhere inside, you mean any one of those inner vectors could repeat the top-level structure?

mmer 2018-08-17T14:13:52.000100Z

The input structure could be contained anywhere in a larger structure and yes that should be a map - sorry

nathanmarz 2018-08-17T14:51:20.000100Z

@mmer do you have an example of a more deeply nested structure?

mmer 2018-08-17T14:53:51.000100Z

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