0

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?

geordie
  • 3,693
  • 1
  • 26
  • 33

1 Answers1

1

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]}

RunnyKine
  • 33,088
  • 3
  • 109
  • 176