I need to find the combinations in a list of lists.
For example give the following list,
List = [[1, 2], [1, 2, 3]]
These should be the output,
Comb = [[1,1],[1,2],[1,3],[2,1],[2,2],[2,3]]
Another example:
List = [[1,2],[1,2],[1,2,3]]
Comb = [[1,1,1],[1,1,2],[1,1,3],[1,2,1],[1,2,2],[1,2,3]….etc]
I know how to do it for a list with two sublists but it needs to work for any number of sublists.
I’m new to prolog, please help.
try returns one list composed of elements of the sublists of the first argument. all finds all such lists.