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 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 <[email protected]> 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"}
>>>
>>> --
>>> --
>>> 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
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.