2

I want 10 variables with constraints, but Prolog only labels 9. Here's my code:

:- use_module(library(clpfd)).
colour(Regions) :-
    Regions = [A,B,C,D,E,F,G,H,I,J],
    Regions ins 1..10, 
    all_distinct(Regions),
    labeling([], Regions).

%%% Output:
?-colour(X).
A = [1, 2, 3, 4, 5, 7, 6, 10, 8|...] ;   % only 9 variables labelled.

Note: It works perfectly fine for ins 1..9 with 9 variables.

false
  • 10,264
  • 13
  • 101
  • 209
dev
  • 2,474
  • 7
  • 29
  • 47
  • 9
    All the variables are labeled. SWI Prolog just abbreviates long lists (with `...`) when displayed. Instead of `;` or space, try `w` at the first prompt for an answer, and subsequent answers will show fully. The `w` will show the full answer. See [Help: I want the whole answer](http://www.swi-prolog.org/FAQ/AllOutput.html). – lurker Apr 21 '14 at 14:39
  • 1
    @lurker that should be an answer, not just a comment. – SQB Mar 25 '16 at 13:40

0 Answers0