title: How to assign value to a variable in CLPFD?
body: <p>There is the predicate <code>indomain/1</code> in <a href="http://sicstus.sics.se/sicstus/docs/4.2.3/html/sicstus/Enumeration-Predicates.html#Enumeration-Predicates" rel="nofollow">manual</a> that assigns values to a variable (let's call it X) in increasing order via backtracking.</p>
  
  <p>I would like to change the order of values that are assigned to the variable X as I try writing a custom labeling predicate. I've come up with this code:</p>
  
  <pre><code>fd_set(X, X_as_set),
  fdset_to_list(X_as_set, X_as_list), % now I have domain of the variable X in form of a list
  % sort X_as_list in some way and return the changed list as X_as_list2
  member(Val, X_as_list2), 
  X = Val   % assign value to CLPFD variable
  </code></pre>
  
  <p>But I don't really know if it is correct or not. Moreover, I'm not sure if it is a proper way how to do it.</p>