Because symbols can only take one argument:
('vector :a) ---> nil
('vector :a :i :x) ---> the exception you saw.
On Wed, Mar 18, 2015 at 2:01 PM, John Gabriele <[email protected]> wrote:
> I see that you can pass extra args to `apply` --- between the func and the
> coll args --- and `apply` will prepend the extras to the coll before
> proceeding. For example, these all work:
>
> (apply + [1 2 3 4])
> (apply + 1 2 [3 4])
> (apply + 1 2 '(3 4))
>
> While thinking about how the following works:
>
> ~~~
> (apply map vector [[:a :b :c]
> [:i :j :k]
> [:x :y :z]])
> ~~~
>
> I found this:
>
> ~~~
> some-app.core=> (apply map [vector [:a :b :c] [:i :j :k] [:x :y :z]])
> ([:a :i :x] [:b :j :y] [:c :k :z])
>
> some-app.core=> (apply map '(vector [:a :b :c] [:i :j :k] [:x :y :z]))
> ArityException Wrong number of args (3) passed to: Symbol
> clojure.lang.AFn.throwArity (AFn.java:429)
> ~~~
>
> Why does it fail when I pass a list there instead of a vector?
>
> --
> 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
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Ben Wolfson
"Human kind has used its intelligence to vary the flavour of drinks, which
may be sweet, aromatic, fermented or spirit-based. ... Family and social
life also offer numerous other occasions to consume drinks for pleasure."
[Larousse, "Drink" entry]
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.