/find-by-key-in-coll.clj Secret
Last active
August 29, 2015 14:01
Star
You must be signed in to star a gist
Is there a cleaner way to find an item in a collection by one of its items keys?
This file contains 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
(def people [{:name "Adam" :age 28} | |
{:name "Chris" :age 25}]) | |
(inc (:age (first (filter #(= (:name %) "Chris") people)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment