Being a newcomer to MathematicaMathematica, I have thisthe following question:.
Given
x = Range@9~Partition~3;
and
y = {a, b, c};
I want to combine xx
and yy
so that
result = {{a, 1, 2, 3}, {b, 4, 5, 6}, {c, 7, 8, 9}};
I have written
MapPrepend[a_, b_] := Prepend[a[[#]], b[[#]]] & /@ Range@Length@b
which does the job, but I wonder if there are other, more functional solutions?
Probably this question has already been answered. In this case it would be very nice if you just would direct me to the links.