Is there a function that takes a list of argument lists and applies each list to a given function?

Ie, something like:

(defn dowith [f & arglists]
  (doseq [args arglists] (apply f args)))

Is there a built-in function in Clojure?

+5
source share
2 answers

I write such things so often; its just so short that it really shouldn't be wrapped:

(map #(apply myfun %) list-of-arglists)

I use it mapmost often, so I get the results and keep them lazy. Of course, if you do not want him to be lazy and do not want results, then he is doseqalso beautiful.

+5
source

No, there is no built-in function that does this.

+3
source

All Articles