On 30/09/2013 15:14, Paul Cannongeyser wrote: > I coded the Who with whom puzzle problem shown in section 3.6 entitled Who with whom? - > propagation, page 120, of AN_CLP.pdf (i.e., the book entitled "A Quick and Gentle Guide to > Constraint Logic Programming via ECLiPSe" by Antoni Niederlinski) from http://www.anclp.pl/. > > :- lib(ic). > > top:- > [Andy,Ben,Carl,Dusty]::[1,4], > [Olive,Eva,Paula,Sabina]::[1,4], These two lines are wrong, they should read [Andy,Ben,Carl,Dusty]::1..4, [Olive,Eva,Paula,Sabina]::1..4, i.e. the variable domains do not consist of the two values 1 and 4, but of the four values in the range 1..4. > ... > write(Olive),write(" "),write(Eva),write(" "), > write(Paula),write(" "),write(Sabina). > > I type "top" into the Query Entry text field, hit Enter, and observe the following in the Results > section. > > ?- top. > No (0.00s cpu) > > I am new to ECLiPSe. I don't understand why at least the write statements at the end of the > program don't print anything. You can read the comma between your constraints as a "sequential AND" operator, similar to && in languages like C or Java. That means, as soon as one constraint is false (in this case Paula#=2), anything to the right of this constraint is not executed anymore. -- JoachimReceived on Mon Sep 30 2013 - 15:21:04 CEST
This archive was generated by hypermail 2.2.0 : Tue Oct 01 2013 - 06:13:23 CEST