Skip to content

Instantly share code, notes, and snippets.

@tolitius
Created January 7, 2017 09:00
Show Gist options
  • Save tolitius/7adcfe25b14a0a4c4e60661de3594426 to your computer and use it in GitHub Desktop.
Save tolitius/7adcfe25b14a0a4c4e60661de3594426 to your computer and use it in GitHub Desktop.
specter: find nested values in a map
$ 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