Re: calling functions that accepts keyword arguments with a map

2015-02-16 Thread Stefan Kamphausen
Hi, On Friday, February 13, 2015 at 8:04:20 PM UTC+1, James Reeves wrote: > > A lot of utility libraries, such as my own Medley > , have "mapply" functions for this > exact use-case. > > Generally, however, I find that keyword arguments are more trouble tha

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread Wilker
I agree with you James, I prefer to just receive maps in my functions. On Fri Feb 13 2015 at 4:04:14 PM James Reeves wrote: > A lot of utility libraries, such as my own Medley > , have "mapply" functions for this > exact use-case. > > Generally, however, I

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread James Reeves
A lot of utility libraries, such as my own 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

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread Wilker
Good point Andy! Yeah, I'll use Francis solution, and actually I'll create a simple helper for the entire thing, as: (defn apply-map [f m] (apply f (apply concat m))) That will make the whole thing much easier, I was hoping that there was something else in the core for helping with that, but if

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread Andy Fingerhut
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

Re: calling functions that accepts keyword arguments with a map

2015-02-13 Thread Francis Avila
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