Say I have a a database with the letters A-G:
elem(a).
elem(b).
...
elem(g).
and I want to make a predicate that gives me all possible combinations of those 7 letters in a list, you could do:
findall(List, permutation([a,b,c,d,e,f,g],List), X).
and X would be a list with all combo's (you don't even need the database for this).
But, what I want however is to make a list of only 5 elements long, with the 7 available letters. How would I be able to do that?