Question on using Array

I can see at least three ways:

Through[{x, y, z}[#]] & /@ vl

Or alternatively:

Transpose[# /@ vl & /@ {x, y, z}]

Or alternatively:

Outer[#2[#1]&, vl, {x, y, z}]

Clear["Global`*"]

vl = {6, 9, 10};

vars3d = Array[Through[{x, y, z}@vl[[#]]] &, 3]

(* {{x[6], y[6], z[6]}, {x[9], y[9], z[9]}, {x[10], y[10], z[10]}} *)

{x[#], y[#], z[#]} & /@ vl

(* {{x[6], y[6], z[6]}, {x[9], y[9], z[9]}, {x[10], y[10], z[10]}} *)

Table[{x[n], y[n], z[n]}, {n, vl}]

(* {{x[6], y[6], z[6]}, {x[9], y[9], z[9]}, {x[10], y[10], z[10]}} *)

% == %% == %%%

(* True *)

If you have to use Array:

Array[Through @ {x, y, z} @ vl[[#]] &, Length @ vl]
 {{x[6], y[6], z[6]}, {x[9], y[9], z[9]}, {x[10], y[10], z[10]}}

Also:

f = Through /@ # /@ #2 &;

f[{x, y, z}, vl]
 {{x[6], y[6], z[6]}, {x[9], y[9], z[9]}, {x[10], y[10], z[10]}}

Tags:

Array

Through