Based on the comments, Listable
is a possible way for you. Thus, you could:
SetAttributes[f,Listable]
and then simply:
f[m1,m2]
to obtain:
{{f[a1, a2], f[b1, b2]}, {f[c1, c2], f[d1, d2]}}
EDIT
To apply this on a built-in (non-Listable
function) like List
on could do, as noted by @rcollyer below:
f[m1,m2]/.f->List
(please also note his comment with regard to Block
!)
Pure function approach
I also propose the following idea, which saves us from the trouble of making the keyfunction Listable
:
Function[{x, y}, anyFunction[x, y], Listable][m1, m2]
The idea is to use a pure function that is Listable
, thus we do not have to modify anyFunction
. This works with List
(instead of anyFunction
) etc. as well.
f
asListable
an option? $\endgroup$Listable
method is simpler than the solutions proposed on your question. $\endgroup$