on-internet
← Community

Prolog: How to create all possible combinations without repetitions

Stack Overflow ·

I am trying to create a predicate that finds all possible combinations without repeating same numbers. I tried using permutation predicate, but it found duplicated lists. For example: permutation([0,1,1], L). L = [0,1,1]; L = [0,1,1]; L = [1,0,1]; L = [1,1,0]; L = [1,0,1]; L = [1,1,0]; What I need: newPermutation([0,1,1], L). L = [0,1,1]; L = [1,0,1]; L = [1,1,0]; Can someone please help me with that? Thanks a lot...

Comments

Sign in or sign up to comment and upvote.

No comments yet.