[ library(ldsb) | Reference Manual | Alphabetic Index ]

# ldsb_indomain(?X)

Instantiates an LDSB integer variable to an element of its domain.

X
  Variable or integer

## Description

Simple predicate for instantiating an integer LDSB variable to an element of its domain. It starts with the smallest element, and upon backtracking tries successive elements until the entire domain has been explored, at which point the predicate fails.

If X is already a ground integer, then this predicate simply succeeds exactly once without leaving a choicepoint.

This predicate can be used with the search/6 predicate (see example).

### Resatisfiable

yes

## Examples

    go :-
            dim(Xs, [3]),
            Xs #:: 1..5,
            collection_to_list(Xs, L), sum(L) #= 10,
            ldsb_initialise(Xs, [variables_interchange]),
            ( search(Xs, 0, input_order, ldsb_indomain, complete, []),
              writeln(Xs),
              fail
            ; true ).

## See Also

ldsb_indomain_set / 1, ldsb_initialise / 2