specter

Latest version: 1.1.3
roklenarcic 2018-07-26T19:07:49.000222Z

I have a double nested map like {:a {:b 1}} and I need get all tuples key1, key2, value where value fits a predicate

roklenarcic 2018-07-26T19:08:06.000275Z

Is there some way I can do this?

nathanmarz 2018-07-26T19:34:50.000255Z

@roklenarcic

(def m {:a {:b 1 :c 2} :d {:e 3 :f 4}})
(def VALS-WITH-KEY (path ALL (collect-one FIRST) LAST))
(select [VALS-WITH-KEY VALS-WITH-KEY even?] m)

roklenarcic 2018-07-26T19:44:27.000129Z

hm I really need to experiment with subpaths more

roklenarcic 2018-07-26T19:44:45.000423Z

thanks

roklenarcic 2018-07-26T19:47:22.000451Z

using path operator is good for performance?

nathanmarz 2018-07-26T19:55:55.000526Z

yes