4

I have a function F[x,y] and a list of the form:

{{a1,b1},{a2,b2},{a3,b3},{an,bn}}

Basically, I want to pass the list mentioned above as the argument to the function F and get the output as a list of the form:

{F[a1,b1],F[a2,b2],F[a3,b3],F[an,bn]}

How do I do this?

rhermans
  • 36,518
  • 4
  • 57
  • 149

4 Answers4

5

Apply at Level 1:

F @@@ list

{F[a1, b1], F[a2, b2], F[a3, b3], F[an, bn]}

kglr
  • 394,356
  • 18
  • 477
  • 896
2

Try

Map[Apply[F, Sequence[#]] &, {{a1, b1}, {a2, b2}, {a3, b3}}]
Ulrich Neumann
  • 53,729
  • 2
  • 23
  • 55
2
MapThread[F,Transpose@lst]

{F[a1, b1], F[a2, b2], F[a3, b3], F[an, bn]}

user1066
  • 17,923
  • 3
  • 31
  • 49
0

You can always define you F with the appropriate pattern

f[{x_, y_}] := f[x, y]

f /@ {{a1, b1}, {a2, b2}, {a3, b3}, {an, bn}}
(* {f[a1, b1], f[a2, b2], f[a3, b3], f[an, bn]} *)

a variant to the other answers would be

Apply[f] /@ {{a1, b1}, {a2, b2}, {a3, b3}, {an, bn}}
(* {f[a1, b1], f[a2, b2], f[a3, b3], f[an, bn]} *)
rhermans
  • 36,518
  • 4
  • 57
  • 149