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

symbol_domain_index(?X, -Domain, -Index)

Map a symbolic domain variable/value to integer variable/value
domain variable or value
Variable, will be bound to a pair Module:DomainName
Variable, will be bound to integer or integer variable


Low-level primitive: For a domain variable or domain value, return the corresponding domain name and an integer or integer variable reflecting the corresponding integer index within the domain order.


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


    ?- symbol_domain_index(we, D, I).
    D = eclipse:weekday
    I = 3
    Yes (0.00s cpu)

    ?- X &:: weekday, X &\= we, symbol_domain_index(X, D, I).
    X = X{[mo, tu, th, fr, sa, su]}
    D = eclipse:weekday
    I = I{[1, 2, 4 .. 7]}
    Yes (0.00s cpu)

See Also

symbols_domain_indices / 3, &:: / 2, domain / 1, domain_index / 3