Hi everyone! I was wondering if there was a better idiom in Clojure
for filtering items from a map... Suppose we want to remove all items
from a map that have an odd number as a value. Here's how I'd write
it:
=> (apply hash-map
(apply concat
(filter (fn [[key val]]
(even? val))
{:dog 5 :cat 4 :mouse 7 :cow 6})))
{:cow 6, :cat 4}
This is ugly. Is there a more elegant way to write this kind of code?
Please share!
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---