Navigation
Synopsis The product of two set values.
Syntax Exp1 * Exp2
Types
Exp1 Exp2 Exp1 * Exp2
set[T1] set[T2] rel[T1,T2]
Description Yields a relation resulting from the product of the values of Exp1 and Exp2. It contains a tuple for each combination of values from both arguments.
Examples
rascal>{1, 2, 3} * {4, 5, 6};
rel[int,int]: {
  <3,6>,
  <2,6>,
  <1,6>,
  <3,5>,
  <3,4>,
  <1,4>,
  <2,5>,
  <2,4>,
  <1,5>
}
A card deck can be created as follows:
rascal>{"clubs", "hearts", "diamonds", "spades"} * {1,2,3,4,5,6,7,8,9,10,11,12,13};
rel[str,int]: {
  <"diamonds",13>,
  <"clubs",13>,
  <"spades",1>,
  <"hearts",3>,
  <"spades",3>,
  <"hearts",1>,
  <"spades",10>,
  <"hearts",10>,
  <"diamonds",10>,
  <"clubs",12>,
  <"clubs",10>,
  <"diamonds",12>,
  <"hearts",4>,
  <"spades",5>,
  <"hearts",7>,
  <"spades",2>,
  <"hearts",2>,
  <"spades",7>,
  <"hearts",5>,
  <"spades",4>,
  <"spades",9>,
  <"hearts",8>,
  <"spades",6>,
  <"hearts",11>,
  <"hearts",6>,
  <"spades",11>,
  <"hearts",9>,
  <"spades",8>,
  <"hearts",12>,
  <"spades",13>,
  <"hearts",13>,
  <"spades",12>,
  <"clubs",3>,
  <"diamonds",1>,
  <"diamonds",3>,
  <"clubs",1>,
  <"diamonds",2>,
  <"clubs",4>,
  <"diamonds",5>,
  <"clubs",7>,
  <"clubs",2>,
  <"diamonds",4>,
  <"clubs",5>,
  <"diamonds",7>,
  <"clubs",8>,
  <"diamonds",6>,
  <"clubs",11>,
  <"diamonds",9>,
  <"clubs",6>,
  <"diamonds",8>,
  <"diamonds",11>,
  <"clubs",9>
}

Questions
Question [1].
The type of [false, true, true] * [false, false, true] is

Question [2].
{43, 22, 2, 13, 17} * {17} == 

Question [3].
{14, 16, 46} * {21, 6} == 

Question [4].
size({7, 41, 17} * {40, 41}) == 



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.