4

What is an idiomatic way to get the maps with a specific value for a particular key in a Clojure seq?

E.g. get the maps in a seq :tag-ed with :fubar value.

(filter #(= (% :tag) :fubar) some-seq)

This works, but I'm guessing there is some more elegant way to do it...

2
  • Are the values always keywords? Commented Jul 25, 2014 at 12:26
  • Yes, the values are always keywords Commented Jul 25, 2014 at 12:38

1 Answer 1

4
(filter (comp #{:fubar} :tag) some-seq) 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.