Say I have two kinds of items
data Item1 = A | B | C data Item2 = D | E | F
And two sets
set1 = [A,B,C] set2 = [D,E,F]
I would like to find all the unique ways of matching elements from two sets, the answer should be (in an unofficial post):
AD,BE,CF AD,BF,CE AE,BD,CF AE,BF,CD AF,BD,CE AF,BE,CD
In other words, I need some function that does the following:
combine :: [Item1] -> [Item2] -> [[(Item1,Item2)]] combine = undefined
Note that each combination must be a tuple, and each line in the enumeration scheme above must be a list, for example:
[(A,D),(B,E),(C,F)]
source share