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

# symbols_domain_indices(+Xs, ?Domain, -Is)

Map symbolic domain variables/values to integer variables/values

Xs
  list of domain variables or values
Domain
  Variable or domain name
Is
  Variable, will be bound to list of integers or integer variables

## Description

Low-level primitive: For a list of domain variables or domain values, return the domain name and a list of integers or integer variables reflecting the corresponding integer index within the domain order. If the domain name is instantiated at call time, the list elements will be checked to be all from this domain.

An error will be reported if not all list elements come from the same domain. If the list contained domain-less variables, then, as a side effect, these will be given a domain to be compatible with the other list elements.

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

### Fail Conditions

X is neither a symbolic domain variable nor a domain constant

## Examples

        ?- symbols_domain_indices([we], D, Is).
        D = eclipse:weekday
        Is = [3]
        Yes (0.00s cpu)

        ?- X &:: weekday, symbols_domain_indices([X], D, Is).
        X = X{[mo, tu, we, th, fr, sa, su]}
        D = weekday
        Is = [X_ic{1 .. 7}]
        Yes (0.00s cpu)

        ?- X &:: weekday, symbols_domain_indices([X, Y, we], D, Is).
        X = X{[mo, tu, we, th, fr, sa, su]}
        Y = Y{[mo, tu, we, th, fr, sa, su]}
        D = eclipse:weekday
        Is = [X_ic{1 .. 7}, X_ic{1 .. 7}, 3]
        Yes (0.00s cpu)

## See Also

symbol_domain_index / 3, &:: / 2, domain / 1