Fork me on GitHub
#specter
<
2016-12-13
>
bcarrell19:12:07

Is there a better way of doing this? I'm a novice (to Specter) trying to figure out if it simplifies my use case: querying a nested data structure which might be in two slightly different shapes for the presence of a value. Here's a gist which hopefully outlines it with a working solution: https://gist.github.com/bcarrell/f9081a7a7a1c5834a09da576a463c9fb

nathanmarz19:12:05

@bcarrell looks pretty good to me

nathanmarz19:12:42

you could factor it into two paths if you want to make it more "readable"

nathanmarz19:12:33

one to navigate to the :foos value you care about (distinguishing between the two "types"), and another using that to search for your target element

bcarrell19:12:11

Cool, thanks! I wanted to make sure it was approaching correctness

nathanmarz19:12:46

you can also change the condition of your if-path to [:foo #(= :bar %)]