This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 BUILT-IN MATHEMATICA SYMBOL Tutorials »| See Also »| More About »

# Tuples

 Tuplesgenerates a list of all possible n-tuples of elements from list. Tuplesgenerates a list of all possible tuples whose i element is from .
• The elements of list are treated as distinct, so that Tuples for a list of length k gives output of length .
• The order of elements in Tuples is based on the order of elements in list, so that Tuples gives .
• Tuples generates a list of all possible ... arrays of elements in list.
• The object list need not have head List. The head at each level in the arrays generated by Tuples will be the same as the head of list.
All possible 3-tuples of and :
The first element given is always picked first:
All ways of picking one element from each list:
All possible 3-tuples of and :
 Out[1]=

The first element given is always picked first:
 Out[1]=

All ways of picking one element from each list:
 Out[1]=
Each occurrence of an element is picked separately:
All possible 2×2 arrays formed from and :
Tuples with any head:
 Applications   (8)
Digits of successive base-2 numbers:
All possible trigrams of and :
Neighborhood rules for an elementary cellular automaton:
Digit sequences, or evolution of a substitution system:
2D lattice of points:
Connect pairs of points in all possible ways:
All possible digit sequences:
Results from Outer involve extra sublists:
Subsets picks each element at most once, and treats reorderings as equivalent:
With one argument, Tuples picks an element from each sublist:
With two arguments, Tuples treats each sublist as a complete element:
3D lattice of points:
New in 5.1