Say I have the following list
{a,{b,c},{d,f,g},e}
what is the fastest way to get the result lists
resultList={{a,b,d,e},{a,c,d,e},{a,b,f,e},{a,c,f,e},{a,b,g,e},{a,c,g,e}}
That is all flattened lists with all possible combinations of the elements of the inner lists ?
I do not care about the order they're obtained in, but I do not want lists like :
{a,a,a,a} or {a,b,b,e}
Note in the inner lists {b,c} and {d,f,g}, the elements (b,c,d,f,g) are actually also lists, it is not the case for the outer elements a and d. Thank you.
Tuples[{{a}, {b, c}, {d, f, g}, {e}}]
? $\endgroup$Level[Transpose[{lst}],{-2}]//Tuples
$\endgroup$