Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say I have a list of arguments, of any length.

How would I add them all together?

f = Evaluate[Plus @@ Array[Slot, 3]] &
f[1, 2, 3]

This would add together 3 numbers, but how would I add together any amount of numbers?

share|improve this question

See SlotSequence. I would use:

f = +## &

f[1, 2, 3]

The long form:

Plus[##1] &

Other forms would be:

Total @ {##} &

Tr @ {##} &

Plus @@ {##} &
share|improve this answer

I'm not sure I'm interpreting your question correctly, but the most obvious way is just

f = Plus;
f[1, 2, 3, 4, 5]

I assume that there is a deeper use case behind your question, so when you clarify what you like to achieve, maybe someone can give you better tips.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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