What is the best way to do this?
in:
{a, b, c}
{d, {e, f}, g}
out:
{{a, d}, {b, e}, {b, f}, {c, g}}
If[Length[#[[2]]] > 0, Transpose[{Table[#[[1]], {x, Length[#[[2]]]}], #[[2]]}], #]
& /@ Partition[Riffle[{a, b, c}, {d, {e, f}, g}], 2]
seems a bit longwinded.
Flatten[MapThread[ArcTan, {{a, b, c}, {d, {e, f}, g}}]] /. ArcTan -> List. – Kuba Feb 20 '15 at 19:27Quiet@Re[{a, b, c}, {d, {e, f}, g}] /. Re -> List. Let me see if I can find it. – Mr.Wizard Feb 20 '15 at 19:32Re: (28693). Sadly no votes. :'-( – Mr.Wizard Feb 20 '15 at 19:34