Slide 16 of 41
Notes:
This is an example of a comprehension that contains two generators but no filter. It performs the following computation: for each element a of x and for each element b of y, insert the pair (a,b) to the resulting set, which is initially empty. For example, if x is the list [1,2,3] and y is the bag {4,5}, the result is a set with 6 pairs. Another example is the above comprehension that filters out of the list [1,2,3] all the elements a less than 2 and adds together the rest.