I have two lists of the same length, the first one a list of integers, and the second one a list of arbitrary-length lists of integers. I would like to make a list of 2-element lists, of all possible pairs of an element from the first list, followed by any of the elements of the list in the corresponding position in the second list. For example. given
{1,2,3}
and
{{x},{y1,y2},{z}}
I would like to construct
{{1,x},{2,y1},{2,y2},{3,z}}
In fact, the first list will always be of the form {1,2,...,n}
.
I've tried many combinations of Inner, Outer, Map, Thread, MapThread, Flatten and other commands, and still haven't succeeded,