What I basically want to achieve is, that given a list of lists A, I want a predicate that checks if the elements of a list B are exactly contained in list A.
So for example:
A = [[1,2],[3,4],[5],[]] B = [1,2,3,4,5]
and
A = [[1,2],[3,4],[5],[]] B = [2,5,3,4,1]
Would result to true, but
A = [[1,2],[3,4],[5],[]] B = [1,2,3,4]
and
A = [[1,2],[3,4],[5],[]] B = [1,2,3,4,5,6]
would both result to false.
is this possible in prolog?
Exactly means: Order doesn't matter, it just has to contain all the elements. Also, imagine that the B list doesn't contain duplicates. So if A would contain duplicates, we should get false as a result.
flatten/2
which will make this simple. – lurker