up previous next
Cartesian Product

Cartesian product
Syntax
 

L_1 >< ... >< L_n

where each L_i is a list.
 

Description
This operator (made using a greater-than sign > and a less-than sign <) returns the list whose elements form the Cartesian product of L_1,...,L_n. For the N-fold product of a list with itself, one may use Tuples .

Example
L := [1,2,3];
L >< ["a","b"] >< [5];
[[1, "a", 5], [1, "b", 5], [2, "a", 5], [2, "b", 5], [3, "a", 5], [3, "b", 5]]
-------------------------------
ChessBoard := (1..8)><(1..8); -- Need brackets around 1..8 otherwise
                              -- we get a parse error. 
Note that only <> is used for not equal in CoCoA.

See Also