@aaelony with specter it would be something like:
(defn first-matching-tag [tag]
(path (filterer #(= (:tag %) tag)) FIRST))
(select
[(first-matching-tag :html)
:content
(first-matching-tag :div)
:content
(first-matching-tag :h2)
ALL
:content
FIRST
(view #(str/split #" "))
(fn [[verb _]] (#{"GET" "POST" "DELETE" "HEAD"} verb))
]
data)
plus a little extra code to do that processing of "inputs" in your code
Thank-you, @nathanmarz. Looks more elegant and concise. I was unaware of the path macro. I’ll need to look into it. Eager to understand Specter better.
@aaelony select
, transform
etc. implicitly use that macro
path
is the heart of what makes specter work
any reason why path instead of select in this case?
first-matching-tag
returns a navigator to be composed with rest of path
select
invokes a navigator on a piece of data
got it. thanks again