Fork me on GitHub
#specter
<
2018-06-17
>
luke.defeo22:06:57

Hello, am i able to use spectres navigation to define what im looking for but return a structure several layers up, say for example i have the following data

(def ctx [
          {
           :id    "blah"
           :name  "News2"
           :rules [["" "sport" "sport"]
                   ["" "messages"]]}
          {
           :name  "News"
           :rules [["" "sport"]
                   ["" "messages"]]}
          {
           :name  "monitoring"
           :rules [["new-relic"]
                   ["stack driver"]]}])
And navigation :
(select-first [ALL :rules ALL ALL #(= % "stack driver")] ctx)
This will return the string “stack driver” is possible it returns its outer record
{
           :name  "monitoring"
           :rules [["new-relic"]
                   ["stack driver"]]}

manas_marthi22:06:01

Hi Nathan, are there any sample data sets to try select and transform

nathanmarz22:06:17

@luke.defeo use selected? for that

nathanmarz22:06:19

(select-first [ALL (selected? :rules ALL ALL #(= % "stack driver"))] ctx)

nathanmarz22:06:24

@manas.marthi you can use anything

nathanmarz22:06:42

e.g. parse some html into a clojure data structure

nathanmarz22:06:07

or just make up small toy examples like in the documentation