The solution I've actually gone with is: (apply esd/search es-index mapping-type (-> options seq flatten))
Seems the most consise and shows the intent of what I'm trying to do quite well - better than a (relatively) confusing `reduce` statement. Again, the help is appreciated. Mark On Tue, Sep 10, 2013 at 8:57 AM, Mark Mandel <mark.man...@gmail.com> wrote: > Thanks for the help all, that gave me some things to think about. > > Cheers, > > Mark > > > On Mon, Sep 9, 2013 at 9:22 PM, Meikel Brandmeyer (kotarak) > <m...@kotka.de>wrote: > >> Hi, >> >> Am Montag, 9. September 2013 12:31:30 UTC+2 schrieb Alex Fowler: >> >>> I would also add that in case, if you *need* to destructure the >>> `options` map for some reason, like: >>> >>> `(defn search >>> "Docstring" >>> [mapping-type & {:keys [option-1 option-2] :as options}] >>> (do-smth-with-option-1 ...) >>> (apply esd/search es-index mapping-type options))` >>> >>> then you can use `mapply` to apply maps to functions that accept >>> optional args maps. The code of mapply is the fllowing: >>> >>> `(defn mapply [f & args] (apply f (apply concat (butlast args) (last >>> args))))` >>> >>> Combining it with partial, as adviced, could give you the functionality >>> you may sometimes need: >>> >>> `(mapply (partial es/search es-index) your-options-map)` >>> >>> >> You don't have to destructure in the argument list: >> >> (defn search >> [mapping-type & options] >> (let [{:keys [option-1]} options >> index (index-based-on option-1)] >> (apply esd/search index mapping-type options))) >> >> Kind regards >> Meikel >> >> -- >> -- >> 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/groups/opt_out. >> > > > > -- > E: mark.man...@gmail.com > T: http://www.twitter.com/neurotic > W: www.compoundtheory.com > > 2 Devs from Down Under Podcast > http://www.2ddu.com/ > -- E: mark.man...@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com 2 Devs from Down Under Podcast http://www.2ddu.com/ -- -- 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/groups/opt_out.