On 26.07.2013 00:34, Brian Craft wrote:
> Is there a better way to do this, making a map of certain keys from a
> list of maps?
>
>> (apply hash-map (mapcat (fn [x] [(x :a) (x :b)]) [{:a "blah" :b "ack"}
> {:a "red" :b "blue"}]))
> {"red" "blue", "blah" "ack"}
Here's another way:
(let [xs [{
You can use whatever functions you want with juxt:
user=> (into {} (map (juxt #(% "a") #(% "b")) [{"a" "blah" "b" "ack"} {"a"
"red" "b" "blue"}]))
{"blah" "ack", "red" "blue"}
On Thursday, July 25, 2013 2:55:18 PM UTC-7, Brian Craft wrote:
>
> Ah, interesting. Only works for keys that are func
I use this:
https://github.com/jaycfields/jry/blob/master/src/clojure/jry/set.clj#L3-L4
On Thu, Jul 25, 2013 at 5:55 PM, Brian Craft wrote:
> Ah, interesting. Only works for keys that are functions.
>
>
> On Thursday, July 25, 2013 2:48:10 PM UTC-7, Gary Trakhman wrote:
>
>> user> (into {} (ma
Ah, interesting. Only works for keys that are functions.
On Thursday, July 25, 2013 2:48:10 PM UTC-7, Gary Trakhman wrote:
>
> user> (into {} (map (juxt :a :b) [{:a "blah" :b "ack"} {:a "red" :b
> "blue"}]))
> {"blah" "ack", "red" "blue"}
>
>
>
> On Thu, Jul 25, 2013 at 5:34 PM, Brian Craft
> >
user> (into {} (map (juxt :a :b) [{:a "blah" :b "ack"} {:a "red" :b
"blue"}]))
{"blah" "ack", "red" "blue"}
On Thu, Jul 25, 2013 at 5:34 PM, Brian Craft wrote:
> Is there a better way to do this, making a map of certain keys from a list
> of maps?
>
> > (apply hash-map (mapcat (fn [x] [(x :a)