There is a significant advantage to Francis's version when keys or values
in the map are collections that flatten flattens:

;; Most likely not the behavior you want:

user=> (flatten (seq {:colors ["red" "blue"] :cursor-set #{"pointer"
"hand"}}))
(:colors "red" "blue" :cursor-set #{"hand" "pointer"})

;; Better:

user=> (apply concat {:colors ["red" "blue"] :cursor-set #{"pointer"
"hand"}})
(:colors ["red" "blue"] :cursor-set #{"hand" "pointer"})

Andy

On Fri, Feb 13, 2015 at 9:44 AM, Francis Avila <fav...@breezeehr.com> wrote:

> Not fundamentally different from your approach:
>
> (apply set-style (apply concat {:color "red" :cursor "pointer"}))
>
>
> On Friday, February 13, 2015 at 11:30:44 AM UTC-6, Wilker wrote:
>>
>> Hi guys,
>>
>> I'm trying to find the best way to call a function that accepts keyword
>> arguments (in my case it's the set-style! on Enfocus library) with a map.
>>
>> So, an example of the regular call:
>>
>> (set-style :color "red" :cursor "pointer")
>>
>> I would like to call with a map (because that way I can manage the map
>> data before using it) but I found no very easy way to do it... The best way
>> I could found is like this:
>>
>> (apply set-style (flatten (seq {:color "red" :cursor "pointer"})))
>>
>> But that's a bit overwhelming, I wonder if there is a simpler way to
>> handle this situation.
>>
>> Thanks.
>>
>  --
> 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
> ---
> 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 clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to