Is there a way to reproduce the effect of
Table[i ** j, {i, list1}, {j, list2}]
using Map instead of Table? Specifically, I want to write something along the lines of
#2 ** #1 & /@ list2 & /@ list1
but tell Mathematica that the first Map (/@ list2
) should map list2
into #1
and the second Map (/@ list1
) should map list1
into #2
. In other words, I basically want Mathematica to evaluate the first Map (/@ list2
) like this:
temp = {# ** list2[[1]], ..., # ** list2[[-1]]}&
and then evaluate the second Map (/@ list1
) and return
temp /@ list1
which should be equivalent to the Table command above.
Outer[NonCommutativeMultiply, list1, list2]
.Outer
is the best. $\endgroup$f @@@ Tuples[{list1, list2}]
$\endgroup$