Created
January 7, 2017 09:00
-
-
Save tolitius/7adcfe25b14a0a4c4e60661de3594426 to your computer and use it in GitHub Desktop.
specter: find nested values in a map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ boot repl | |
boot.user=> (set-env! :dependencies '[[com.rpl/specter "0.13.2"]]) | |
boot.user=> (require '[com.rpl.specter :as s]) | |
boot.user=> (def m {:a 34 :b 28 :c {:bingo 40 :d 23 :e {:bingo 41}} :bingo 42}) | |
#'boot.user/m | |
boot.user=> (s/select [(s/walker #(and (coll? %) | |
(= :bingo (first %)))) | |
(s/view second)] m) | |
[40 41 42] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment