A lot of utility libraries, such as my own Medley
<https://github.com/weavejester/medley>, have "mapply" functions for this
exact use-case.

Generally, however, I find that keyword arguments are more trouble than
they're worth. You only save two characters, and give up a lot on terms of
being able to easily compose and extend functions.

- James

On 13 February 2015 at 17:30, Wilker <wilkerlu...@gmail.com> 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