Oups, indeed this doesn't solve the problem, this other solution works (just
a variant of Kresimir's one) :

(reduce (fn [m [k v]] (update-in m [k] #(conj (or %1 []) %2) v)) {} [[:a 1]
[:b 3] [:b 5] [:c 1]])

2009/6/24 Laurent PETIT <laurent.pe...@gmail.com>

> Does this fit your need ? :
>
> (reduce (fn [m [k v]] (assoc m k [v])) {} [[:a 1] [:b 3] [:b 5] [:c 1]])
>
> HTH,
>
> --
> Laurent
>
> 2009/6/24 samppi <rbysam...@gmail.com>
>
>
>> 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?
>>
>> >>
>>
>
>
>


-- 
Cordialement,

Laurent PETIT

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to