Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I think this is a basic question, but I am having difficulty finding the answer in the documentation. Thread is not what I am looking for, I think.

Suppose that I have a function f that takes an unspecified number of arguments: f[a, b, c, ...], defined by a declaration like f[lists__] := .... Suppose that I have an argument list {a, b, c, d}. How can I obtain f[a, b, c, d] from {a, b, c, d}? Thanks.

share|improve this question

closed as too localized by Oleksandr R., Andrew, halirutan, belisarius, rcollyer Sep 20 '12 at 5:26

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

f @@ {a, b, c, d}? For more, see the documentation for Apply. –  Oleksandr R. Sep 19 '12 at 20:24
As (by your own admission) this is very basic and well-covered in the documentation, I'm voting to close as too localized. Nothing personal, of course (everyone has mental lapses!), but I doubt this will be terribly useful to the next person. It's up to you of course, but I would tend to suggest asking questions like this informally in the chat. –  Oleksandr R. Sep 19 '12 at 20:28
@OleksandrR. I agree with closing this question. I have added a vote to close. –  Andrew Sep 19 '12 at 20:38
@OleksandrR. I'm hesitating to close this as TL. There are more questions like this on the Internet, so the OP is not alone. And what is obvious to you may not be obvious to everyone. We've had more questions that could be answered by a single link to the documentation and they weren't all closed. So, why close this one? Just curious. –  Sjoerd C. de Vries Sep 19 '12 at 21:06
@Sjoerd I would be in favor of closing all questions that do nothing but duplicate what's already said in the documentation. If I haven't consistently voted as such then either it's an oversight on my part or someone went beyond the documentation in an answer. By the way, I do consider the voting process itself important; as you rightly state, not everyone will take the same view on what is or isn't obvious. If I'm in the minority, I will be happy to see the question remain open. –  Oleksandr R. Sep 19 '12 at 21:18

2 Answers 2

up vote 3 down vote accepted

It seems I have found the answer: Apply.

Apply[f, {a, b, c, d}]

gives the output:

f[a, b, c, d]

share|improve this answer

Of course Apply, but also:

 f[{a, b, c, d} /. List -> Sequence]

f[a, b, c, d]

(my finger is hovering above the 'close' link, though)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.