Map
will iterate over the list and apply some function element-wise. In your case, list
is a 2D-array, so Map
will iterate over the the elements of list
, which are {100,100}
and {200,200}
. These are the values that are then applied to Transpose
, which will clearly fail.
To better illustrate this, you can use some undetermined function f
to see what's going on:
Clear[f]
Map[f[#] &, list]
(* {f[{100, 100}], f[{200, 200}]} *)
Replacing f
with Transpose
would then give
{Transpose[{100, 100}], Transpose[{200, 200}]}
which results in an error.
Edit: As Chris mentioned in the comments, this behavior can be controlled by the level spec. By, default, Map
will map at the "first" level, which in the case of a 2D array like here, means that the mapped elements are lists themselves. However, if you use
Map[Transpose, list, {0}]
this forces Map
to only map elements on the "zeroth" level, which means the whole expression. This would be equivalent to
Transpose[list]
If you use level 2, Map
would go over every element in the 2D array like this:
Map[f, list, {2}]
(* {{f[100], f[100]}, {f[200], f[200]}} *)
Map[Transpose, list, {0}]
$\endgroup$Transpose[#]&
can be simplified asTranspose
. $\endgroup$Map[Transpose[#]&, list]
takes each entry of the list, puts it where the#
is and wraps the resulting sequence with{ }
. $\endgroup$