My question is, what list p in the following statement returns the list q?
Tuples[{{p},{q}}]
If we think of Tuples as a binary operator then p would be the identity for Tuples.
I thought an empty list would work, but evaluating the following
Tuples[{{},{1,2,3}}]
gives {} instead of {1,2,3} or {{1},{2},{3}} as I had hoped.
The following doesn't work either:
Tuples[{{\[EmptySet]},{1,2,3}}]
Certainly, I could write a function like the following
altTuples[p_List,q_List]:= If[Length[p]==0,q,Tuples[{p,q}]
That does exactly what I want, but I want to know if I'm missing something. Is there in fact an identity for Tuples? Is there a way to do what I want with Outer? I've tried the obvious solutions with no luck.
altTuples[]
to behave when the length of $p$ is not zero? For examplealtTuples[{a, b, c}, {d, e, f}]
returnsTuples[{a, b, c}, {d, e, f}]
, probably not what you want. $\endgroup$