On 14 December 2016 at 17:38, Rafo Ufoun <[email protected]> wrote:
> Hi, thank you for your response !
>
> I know the '& args' notation, but I thought that this notation expected a
> collection *after *the &, so in the apply signature, we expect a fn, 4
> args and then, a sequence.
>
> In this call : (apply + 1 1 1 1 1 1 1 1 1 1 1 [2 3]), the & should be here
> : (apply + 1 1 1 1 *&* 1 1 1 1 1 1 1 [2 3])
>
> If I understand what you're saying, all the parameters after the & and the
> [2 3] sequence is converted into a single sequence, thanks to the & ?
>
Yes, though the [2 3] vector will be inside the args sequence. So if you
had:
(apply + 1 1 1 1 1 1 1 1 1 1 1 [2 3])
And the arguments of apply are:
[f a b c d & args]
Then:
f = +
a = 1
b = 1
c = 1
d = 1
args = (1 1 1 1 1 1 1 [2 3])
Internally, the function combines the last value of args with the rest.
- James
--
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.