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.

This question already has an answer here:

Evaluating the following

func[x_, y_] := x^2 + y^2

listn = {{a, b}, {c, d}, {e, f}};
Map[func[##] &, listn, {1}]

yields

{func[{a, b}], func[{c, d}], func[{e, f}]}

What I want to end up with is

{func[a, b], func[c, d], func[e, f]}

How do I do this?

share|improve this question
add comment

marked as duplicate by Mr.Wizard Jul 5 '13 at 6:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 1 down vote accepted

Use Apply at level 1 i.e @@@, like this

func[x_, y_] := x^2 + y^2
listn = {{a, b}, {c, d}, {e, f}};

Then

func @@@ listn

This gives:

{a^2 + b^2, c^2 + d^2, e^2 + f^2}.

Which is equivalent to

{func[a,b], func[c,d], func[e,f]}

share|improve this answer
    
+1 Many thanks! –  geordie Jul 5 '13 at 3:20
add comment

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