On Sun, Jun 12, 2011 at 7:36 PM, Jeff Sigmon <[email protected]> wrote: > Wonderful! Pretty cool how the map itself is the predicate to the some > function.
Yes, a map is a function from its keys to its to values, just as a keyword is also a function (from a map to a value identified by that keyword). And, as Meikel notes, if you have a value of false or nil in your map, my "shortcut" won't work. If you're on Clojure 1.3.0, a solution that addresses Meikel's concern would be: (defn filter-keys [coll keys] (filter (apply some-fn (map #(fn [c] (find c %)) keys)) coll)) Maybe someone can clean that up? -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ "Perfection is the enemy of the good." -- Gustave Flaubert, French realist novelist (1821-1880) -- 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
