Evaluate a list

You say that func[{1,2,3}] doesn't work, but in Mathematica we can actually define such functions. We just have to write

func[{a_, b_, c_}] := a^2 + b^2 + c^2;

and boom, now it works. Now you can do

func /@ list

or

func@Transpose@list

The latter works because of something called "listability". You can also use that with your original definition of func, using Apply like so: func@@Transpose@list, but there is no advantage to using Apply in this manner rather than the way in which Szalbocs used it.

By the way Map or /@ as it is also written is what you should be using instead of Table[var[[i]],{i,...}]. To begin with you can think of it as the equivalent of that, but with a simpler syntax.


Use Apply. The following will work:

func @@@ list

Example:

In[1]:= f @@ {1, 2, 3}
Out[1]= f[1, 2, 3]

In[2]:= f @@@ {{1, 2, 3}, {4, 5, 6}}
Out[2]= {f[1, 2, 3], f[4, 5, 6]}