Recursive map query using specter
问题 Is there a simple way in specter to collect all the structure satisfying a predicate ? (./pull '[com.rpl/specter "1.0.0"]) (use 'com.rpl.specter) (def data {:items [{:name "Washing machine" :subparts [{:name "Ballast" :weight 1} {:name "Hull" :weight 2}]}]}) (reduce + (select [(walker :weight) :weight] data)) ;=> 3 (select [(walker :name) :name] data) ;=> ["Washing machine"] How can we get all the value for :name, including ["Ballast" "Hull"] ? 回答1: Here's one way, using recursive-path and