Come to think of it, this would also work for me: keeping the vector of pairs, and instead using filter to get the "values" of a key:
(defn get-from-pairs [pairs key-to-fetch] (map #(get % 1) (filter #(= key-to-fetch (get % 0)) pairs))) (I wish the key and val functions were defined on vectors too. :( ) Is there still a better Clojure way? On Jun 23, 3:09 pm, samppi <rbysam...@gmail.com> wrote: > The idiom (into {} coll-of-entries) is often used to create a map from > a collection of entries or two-sized vectors. But what if I want to do > something like this: > > (mystery-fn [[:a 1] [:b 3] [:b 5] [:c 1]]) ; returns {:a [1], :b [3 > 5], :c [1]}) > > The only way I can think of doing this is with a complex loop > construction. But can mystery-fn be built without resorting to that? > What would be the best way? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---