A combination of a list given a length followed by a permutation in Prolog?
问题 I need a predicate to return a list with all combinations of the input list, and the list result size is in the second param, the predicate would be like this permutInListN( +inputList, +lengthListResult, -ListResult), example: permutInListN([1,2,3],2,L). ? L=[1,2]. ? L=[2,1]. ? L=[1,3]. ? L=[3,1]. ? L=[2,3]. ? L=[3,2]. Combinations of [1,2,3] in a list L with length 2 . with no repetitions maybe using setoff. this is my code but it doesn't work at all , no generate all solutions