Category "clpfd"

How to generate a list with only two 1s and other 0s of the given length?

I have to generate lists that consist of 2 '1's and other elements are '0's. I tried the following code but it does not work: count([], _, 0). count([X|T], X,

Constraint Programming library or syntax issue in SWI-Prolog

I'm just trying to figure out constraint programming in SWI-Prolog, looking at this tutorial : http://en.wikibooks.org/wiki/Prolog/Constraint_Logic_Programming