Renata,

It depends on what you want to with the results of treat-request.  If you
don't care about them, which seems like the case:

(doseq <https://clojuredocs.org/clojure.core/doseq> [[x y z] [x1 y1 z1] [x2
y2 z2] [x3 y3 z3]]
  (treat-request x y z))

Is one way to accomplish it.  If you want a collection of the results,
replace doseq with for <https://clojuredocs.org/clojure.core/for> (maybe
take a look at doall <https://clojuredocs.org/clojure.core/doall>, also).

In terms of the general approach - if the goal is to end up with a sequence
containing only the specified keys from each map (i.e. the 'collection'
argument is the same for all invocations), then you can accomplish this
without an atom:

(for [[m ks] [[m1 ks1] [m2 ks2] ...]]
  (select-keys m ks))

Does just that.

Take care,
Moe

On Thu, Mar 29, 2018 at 12:27 AM, Renata Soares <renata.sd...@gmail.com>
wrote:

> Good night,
>
> I have this function:
>
> (defn treat-requests [input key-request collection]
> (let [selecteds (select-keys input key-request)]
> (swap! collection conj selecteds)))
>
> and I want to execute that 3 times with 3 differents arguments
>
> How can I do to apply a list of differents arguments to a function?
>
> Instead of calling 3 times like:
>
> (treat-request x1 y1 z1)
> (treat-request x2 y2 z2)
> (treat-request x3 y3 z3)
>
> I want to call one time. For example... (apply treat-request [x1 y1 z1]
> [x2 y2 z2] [x3 y3 z3])
>
>
> --
> 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