You are searching map.

You should definitely consider reading the datastructures and sequences
pages on clojure.org, or you will be stopped at each step.

Regards,

-- 
Laurent

2009/7/22 mmwaikar <[email protected]>

>
> Hi,
>
> I am getting a little confused in how apply works. I thought that
> (apply f args* argseq) means applying f to each of the elements of
> argseq one by one (assuming one doesn't pass any args), but it is not
> like that. So for ex,
>
> I wrote this: (defn mul5 [arg] (* arg 5))
> and wanted to do this: (apply mul5 1 2 3 [4 5])
>
> thinking that I'll get a list back where each element of the original
> list is multiplied by 5, but I get IllegalArgumentException: Wrong
> number of args passed to: mul5.
>
> So if this is the intended behavior of apply, which function should I
> use in this case? Is there anything in Clojure where I can apply any
> user-defined function to each and every element of a list one-by-one?
>
> Thanks for the replies.
>
> Regards,
> Manoj.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to