On Jun 16, 2010, at 7:07 PM, ataggart wrote: > There's a disconnect between the function definition and the > datastructures used by the caller. > > Either fix the data structure: > (def args [:bar 2 :baz [:quux]]) > then use apply > > Or change the function definition to take a map: > (defn foo [x {:keys [bar baz]}] > ...)
That's a pretty flippant answer. I have run into this same issue; it's not always desirable to have your function take a map, and if you get the data structure from elsewhere (say loaded from a config file), then you have to resort to either re-building the arg list manually or doing (apply concat ...). Regarding Brian's original question: as far as I know, there is no built-in version of apply that works with keyword args contained in a map. But note that you can eliminate the call to seq, since (apply concat args) works the same as (apply concat (seq args)). -- 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