This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-13
Channels
- # bangalore-clj (5)
- # beginners (94)
- # boot (145)
- # cljs-dev (4)
- # cljsjs (79)
- # cljsrn (18)
- # clojure (343)
- # clojure-dev (21)
- # clojure-dusseldorf (6)
- # clojure-india (1)
- # clojure-italy (2)
- # clojure-nl (4)
- # clojure-russia (62)
- # clojure-sanfrancisco (1)
- # clojure-spec (109)
- # clojure-taiwan (1)
- # clojure-uk (103)
- # clojurescript (102)
- # code-reviews (30)
- # component (1)
- # cursive (39)
- # datascript (7)
- # datomic (68)
- # emacs (11)
- # figwheel (1)
- # gorilla (1)
- # hoplon (234)
- # off-topic (46)
- # om (52)
- # onyx (32)
- # planck (9)
- # proton (4)
- # protorepl (5)
- # random (1)
- # re-frame (36)
- # ring (18)
- # ring-swagger (1)
- # specter (6)
- # untangled (3)
- # vim (56)
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
@bcarrell looks pretty good to me
you could factor it into two paths if you want to make it more "readable"
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
you can also change the condition of your if-path
to [:foo #(= :bar %)]