Fork me on GitHub
#specter
<
2023-12-05
>
J20:12:20

Hi guys! I have this kind of data:

(def index
  {"foo/article/*" {:exclude #{:a} :include #{:b}}
   "foo*" {:exclude #{:c}}
   "baz" {:exclude #{:d} :include #{:a}}})
I want to match all exclude and include keys for all the key who end with a *. This works:
(def ks (s/select [s/MAP-KEYS (s/pred #(str/ends-with? % "*"))] index))
  (def path (apply s/multi-path (mapv #(vector (s/keypath %)) ks)))
  (s/select path url-index)
but is there an other way to achieve this query?

xificurC20:12:06

[s/ALL (fn [[k v]] (str/ends-with? k "*")) s/LAST]. Untested

J20:12:58

Yes it works! Thanks!