# Set ** Set -- Cartesian product

## Synopsis

• Usage:
x ** y
• Operator: **
• Inputs:
• Outputs:
• a set, whose elements are the sequences (a,b), where a is an element of x, and b is an element of y.

## Description

 ```i1 : set {1,2} ** set {a,b,c} o1 = set {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} o1 : Set```
Suppose we wish to form the set of all triples with entries either in the set A below.
 ```i2 : A = set{1,2} o2 = set {1, 2} o2 : Set``` ```i3 : A ** A ** A o3 = set {((1, 1), 1), ((1, 1), 2), ((1, 2), 1), ((1, 2), 2), ((2, 1), 1), ------------------------------------------------------------------------ ((2, 1), 2), ((2, 2), 1), ((2, 2), 2)} o3 : Set```
To make this last a set of triples, splice each element together. Or, use VirtualTally ^** ZZ.
 ```i4 : (A ** A ** A)/splice o4 = set {(1, 1, 1), (1, 1, 2), (1, 2, 1), (1, 2, 2), (2, 1, 1), (2, 1, 2), ------------------------------------------------------------------------ (2, 2, 1), (2, 2, 2)} o4 : Set``` ```i5 : A^**3 o5 = set {((1, 1), 1), ((1, 1), 2), ((1, 2), 1), ((1, 2), 2), ((2, 1), 1), ------------------------------------------------------------------------ ((2, 1), 2), ((2, 2), 1), ((2, 2), 2)} o5 : Set```