Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Binary Permutations

Status
Not open for further replies.

4766667

Programmer
Feb 26, 2012
1
PL
Hello everyone,

I'm new with prolog and I don't have any clue about it. Does someone know how to write binary permutations with a const number of 1? For example all 9 bit words with 5 ones. I would be thankful for all help.
 
hi

perhaps you need random sequences of the same word
 
what you need is a predicate of shuffle. there are many
 
this solution is something incompleted

permutation([ ],[ ]).
permutation( [X | L] , P ):permutation(L,L1),add (X, L1, [ L1 | P ]).


:permutation([0,1,1,0,1,1,1,0],L).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top