cross

cross, keyword

The cross keyword creates a table as the cartesian product of two tables. The resulting table extends both originating tables dimension-wise.

Example:

table Products[product] = with
  [| as Product, as Price |]
  [| "shirt",  11.25 |]
  [| "pant",   25.75 |]
  [| "cap",     5.75 |]

table Colors[color] = with
  [| as Color |]
  [| "white" |]
  [| "black" |]
  [| "blue"  |]
  [| "red"   |]

table Variants = cross(Products, Colors)

show table "All variants" a1c10 with
  Variants.product
  Variants.color
  Products.Price