0

Suppose that I have the following list, called list. list contains elements X, X1, X2, and X3:

list = {X, {X1, X2, X3}}

I would like a function that operates on list and gives the following output list:

{{X, X1}, {X, X2}, {X, X3}}

Is there a simple way to accomplish this with Thread, MapThread, Inner, Through, or the like? I feel like this should be simple, but I am having a lot of trouble coming up with a simple solution.

So far, I have only been able to come up with rather complicated solutions, such as

Transpose[{Table[#[[1]], {Length[#[[2]]]}], #[[2]]}] &@list

{{X, X1}, {X, X2}, {X, X3}}

Andrew
  • 10,569
  • 5
  • 51
  • 104

0 Answers0