Im trying to figure out how to get Prolog to generate all possible pairs from a deck of cards. I have found example where lists are used to represent all possible cards in the deck, and then using the list to get possible pairs. However I would like to generate pairs directly from the relations of card instead of using a list of cards. The problem im having with a naive implementation is that im getting all permutations instead of combinations, that is get:
C1 = king spade C2 = king club AND C1 = king club C2 = king spade
But in my example these two pairs are the same.
Below is how I represent cards in Prolog.
suite(spade).
suite(heart).
suite(diamond).
suite(club).
num(queen).
num(king).
Now my questions are: 1. What is the reason most examples uses lists when deling with different card combinatorial examples instead of using relations directly to query for possible pairs, straights etc? 2. How would a predicate look to query for all possible pairs combinations given the relations shown above?